waitForElementPresent failing

361 views
Skip to first unread message

barry

unread,
May 1, 2014, 2:54:16 PM5/1/14
to xeb...@googlegroups.com
I've been creating some basic tests against my company's application to evaluate Xebium.

Our app is a single page app with lots of ajax and etc., so pretty much every assertion will involve some amount of waiting for the right elements to arrive and be available for interaction in the DOM.

Using the Selenium IDE in firefox I am able to create several Selenium scripts that run through a bunch of basic operations successfully. Exporting from the IDE with the Xebium formatter, the scripts make use of the following pattern many, many times:

| ensure | do | waitForElementPresent | on | css=span:contains('Some Text') |
| ensure | do | click | on | css=span:contains('Some Text') |

However, these lines always succeed when run in Selenium IDE. And they always fail when run in Fitnesse/Xebium.

I have tried replacing the css selectors in the script with the equivalent xpath selectors and they still fail. And it's not a matter of timing or timeout settings as I can see the fitnesse run just sitting and waiting and retrying well after the element has arrived.

What else can I try here? The Selenium IDE runs prove that the selectors are correct and should eventually resolve as "present". But the Xebium runs fail to see them every time...?

Thanks.

Arnout Engelen

unread,
May 2, 2014, 2:38:29 AM5/2/14
to xeb...@googlegroups.com
Hi Barry,

On Thu, May 1, 2014 at 8:54 PM, barry <bla...@gmail.com> wrote:
Our app is a single page app with lots of ajax and etc., so pretty much every assertion will involve some amount of waiting for the right elements to arrive and be available for interaction in the DOM.

Which frameworks are you using? Explicitly waiting for elements to arrive is a perfectly fine approach, but some frameworks allow a more generic approach, which could make your tests a bit less brittle.
 
| ensure | do | waitForElementPresent | on | css=span:contains('Some Text') |
| ensure | do | click | on | css=span:contains('Some Text') |

However, these lines always succeed when run in Selenium IDE. And they always fail when run in Fitnesse/Xebium.

I have tried replacing the css selectors in the script with the equivalent xpath selectors and they still fail. And it's not a matter of timing or timeout settings as I can see the fitnesse run just sitting and waiting and retrying well after the element has arrived.

What else can I try here? The Selenium IDE runs prove that the selectors are correct and should eventually resolve as "present". But the Xebium runs fail to see them every time...?

'waitForElementPresent' should definitely work, and a quick test here reveals no problems. 2 things I could imagine going on here: 

1) perhaps some kind of clash between the selenium version used and the version of the browser you're using. Perhaps try running the test on different browsers?

2) Something funny in your page that throws the selector off. Have you tried using a 'waitForTextPresent' on another more static/simple site? Did that work? I seem to remember there's some situations with iframes that can cause trouble.


Arnout

Cirilo Wortel

unread,
May 2, 2014, 5:36:58 AM5/2/14
to xeb...@googlegroups.com, xeb...@googlegroups.com
Try removing the css= 
I think this might be a formatter issue. 

If this is not the case, try escaping the locator text (by placing !-text-! around it. Or escaping the entire table (start table with an exclamation mark, !|script|). This wat you're sure you locator is not malformed by wiki markup.

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.

bla...@gmail.com

unread,
May 6, 2014, 5:21:08 PM5/6/14
to xeb...@googlegroups.com
Thanks so much for the replies. I do have a green / working test now, which will be enough to evaluate the technology and figure out what we might or might not do next.

There were some iframes involved. So there did need to be some driver.SwitchTo().Frame() calls involved before elements could be successfully found.

And the css selectors with :contains still fail. But I am able to run our basic tests with other selectors that are working (...given the proper frame switches). Some are now ids, some xpath, etc.

So we're green for now and continuing to evaluate. Thanks again.

Message has been deleted

Cirilo Wortel

unread,
Jun 8, 2016, 4:50:14 AM6/8/16
to xeb...@googlegroups.com
I do not see a resemblance to the variable issue. Could you please elaborate on the problem, what is not working exactly?

On Fri, Jun 3, 2016 at 8:31 PM, <alexros...@gmail.com> wrote:
I'm having the same issue here, but I can't figure it out. New to industry programming, so bear with me.

Here's my script:

|script       |selenium driver fixture                                              |
|start browser|firefox|on url               |https://www.google.com/                |
|do           |open   |on                   |/?gws_rd=ssl                           |
|ensure       |do     |type                 |on|id=lst-ib     |with     |xebium     |
|ensure       |do     |waitForElementPresent|on|link=Xebium - Selenium from FitNesse|
|ensure       |do     |clickAndWait         |on|link=Xebium - Selenium from FitNesse|
|ensure       |do     |waitForText          |on|css=h1        |with     |Xebium     |
|check        |is     |verifyText           |on|css=h1        |Xebium               |
|stop browser               

All I'm doing is googling xebium and trying to follow the first link. Any clue what's wrong?
Reply all
Reply to author
Forward
0 new messages