Element not found in the cache-exception

瀏覽次數:90 次
跳到第一則未讀訊息

stephanv

未讀,
2015年2月17日 上午11:25:242015/2/17
收件者:xeb...@googlegroups.com
In Xebium I get the following error: "java.lang.AssertionError: com.thoughtworks.selenium.SeleniumException: Element not found in the cache - perhaps the page has changed since it was looked up".
When I run the command in the Selenium IDE it works just fine.

It is triggered by the next command: "| ensure | do | sendKeys | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | 2 |"

I think it's caused by the 'onchange'-event in the input-type. See html of the textbox:
  <input class="quantity" type="text" onchange="this.form.submit();" value="2" name="Quantity">

I've tried to use other commands (typeKeys, keyPress), but with no luck.

I hope someone has an answer to fix this...

Kind regards,
Stephan

alber...@gmail.com

未讀,
2015年3月3日 凌晨4:46:512015/3/3
收件者:xeb...@googlegroups.com
Please try to waitForElementLocated just before the sendKeys. Selenium has probably located the element before the page was changed. Therefor it can't find the element anymore and returns a StaleElementReferenceException.

Op dinsdag 17 februari 2015 17:25:24 UTC+1 schreef stephanv:

stephanv

未讀,
2015年3月25日 凌晨3:54:432015/3/25
收件者:xeb...@googlegroups.com
Thanks for the reply.
waitForElementLocated isn't a Xebium-command. waitForElementPresent is, but still I get this exception. Even if I build in a delay for 2 seconds (with the pause-command).
I've tested this in an old image with WindowsXP with Xebium v0.11 and the same script works as expected.
Has anyone any other thoughts on this?

Op dinsdag 3 maart 2015 10:46:51 UTC+1 schreef Albert Roos:

Cirilo Wortel

未讀,
2015年3月25日 清晨7:32:462015/3/25
收件者:xeb...@googlegroups.com
Is there added value in using sendkeys, or would a regular "type" be sufficient? I have never been really successful with sendKeys in combination with webdriver.

Met vriendelijke groeten/Kind Regards,

Cirilo
--
You received this message because you are subscribed to the Google Groups "Xebium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xebium+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stephanv

未讀,
2016年9月4日 上午9:31:042016/9/4
收件者:Xebium
Hi again,

Issue still occurs. No solution found yet. So I'll try again.

It's about this MS-website: http://tailspintoys.azurewebsites.net/

These are the Xebium-commands:

| script |
| start browser | firefox | on url | http://tailspintoys.azurewebsites.net/ |
| do | open | on | / |
| ensure | do | clickAndWait | on | link=Model Airplanes |
| ensure | do | clickAndWait | on | link=Fourth Coffee Flyer |
| ensure | do | clickAndWait | on | css=input.add-cart |
| ensure | do | clickAndWait | on | link=Paper Airplanes |
| ensure | do | clickAndWait | on | link=World Wide Importer |
| ensure | do | clickAndWait | on | css=input.add-cart |
| ensure | do | typeAndWait | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | 2 |
| ensure | do | clickAndWait | on | css=input.checkout |
| ensure | do | type | on | id=FirstName | with | John |
| ensure | do | type | on | id=LastName | with | Doe |
| ensure | do | type | on | id=Email | with | !-j...@doe.com-! |
| ensure | do | type | on | id=Street1 | with | Test 123 |
| ensure | do | type | on | id=City | with | Hilversum |
| ensure | do | select | on | id=countrySelect | with | label=Netherlands |
| ensure | do | select | on | id=stateSelect | with | label=Utrecht |
| ensure | do | type | on | id=Zip | with | 9999AB |
| ensure | do | clickAndWait | on | css=input.textbutton |
| ensure | do | clickAndWait | on | name=id |
| check | is | verifyText | on | !-//div[@id='bdy']/div/div[2]/div/fieldset[2]/table[2]/tbody/tr[8]/td[2]/b-! | $154.00 |
| stop browser |

When I run this in Selenium (IDE) it works just fine. When I do the same in Xebium (and run it with firefox) it still breaks at the "Quantity"-input box.

I hope someone has a solution for me...
Thnx in advance!

Kind regards,
Stephan

Cirilo Wortel

未讀,
2016年9月5日 凌晨3:05:142016/9/5
收件者:Xebium
Hi Stephan,

In my experience the clickAndWaits don't do a lot more than just a click.

What happens in SeleniumIDE is that you can turn down the speed, making everything work. What helps here, is to wait for the element before interacting with it. This will ensure that the availablity of the element is not causing the issue.

| ensure | do | waitForElementPresent | on | !-xpath=(//input[@name='Quantity'])[2]-! |
| ensure | do | type | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | 2 |



Op zondag 4 september 2016 15:31:04 UTC+2 schreef stephanv:

stephanv

未讀,
2016年9月7日 凌晨2:13:312016/9/7
收件者:Xebium
Hi Cirilo,

Thanks for your quick reply. Tried your tip, but got not the wanted result.
In FireFox I see the textbox gets the focus, but the default value ("1") won't change to 2. I also tried:
    • | ensure | do | type | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | 2 |
    • | ensure | do | type | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | !-2-! |
    • | ensure | do | typeAndWait | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | 2 |
    • | ensure | do | sendKeys | on | !-xpath=(//input[@name='Quantity'])[2]-! | with | 2 |

    All attempts failed.
    Hope you (or someone else) has another tip.

    Kind regards,
    Stephan

    Op maandag 5 september 2016 09:05:14 UTC+2 schreef Cirilo Wortel:

    Cirilo Wortel

    未讀,
    2016年9月7日 清晨5:08:572016/9/7
    收件者:xeb...@googlegroups.com
    Hi Stephan,

    I looked into it for just a bit, I don't see anything wrong with the xpath. My only hunch is that it needs to change focus in order to activate the onchange="this.form.submit(); 

    But ïm just guessing here. I don't have a good answer for you, I'm sorry.

    --
    You received this message because you are subscribed to the Google Groups "Xebium" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to xebium+unsubscribe@googlegroups.com.

    Stefan Assenberg

    未讀,
    2016年9月27日 上午10:08:582016/9/27
    收件者:Xebium
    Looking at the site you use for this test, I think in a selenium-course that I took we used the same site. 
    Was this the case for you also?

    As far as I can tell, the problem is that the actual input field for the quantity is hidden. 

    <input name="id" value="papwwi" type="hidden">

    Xebium can not use a hidden field to input the value.
    I tried using different locators etc, but all with the same result as you;

    I have encountered "similar" problems IRL, in which case the solution is to get the developers to code the fields needed for testing in such a way that automated testing is possible with Xebium / Selenium.
    For example to get them to give unique ID's to all the fields on the website under test.

    Albert Roos

    未讀,
    2016年10月10日 清晨7:53:232016/10/10
    收件者:xeb...@googlegroups.com
    unsubscribe

    --
    You received this message because you are subscribed to a topic in the Google Groups "Xebium" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/xebium/jp9vj2khN5o/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to xebium+unsubscribe@googlegroups.com.
    回覆所有人
    回覆作者
    轉寄
    0 則新訊息