Share
Go down
madisonli2007
Posts : 5
Join date : 2010-08-03

selenium.isElementPresent("some_button") is not reliable

on Sat Aug 14, 2010 1:10 am
Hi, I'm using java api and call selenium.isElementPresent("some_obj") constantly. However I found that half of the time the call fails with "obj not found". If this function only works 50% of time, what's the use of it? Smile
Any thoughts?
avatar
Advisor
------------------------
------------------------
Posts : 383
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: selenium.isElementPresent("some_button") is not reliable

on Sun Aug 15, 2010 11:26 am
hi,

It's work every time if object will present. The reasons your element will identify are as follows:

1. your page is not fully loaded and selenium try to search element. Try to use wait or waittopageload command.
2. May be your id is generated dynamically at run time with different id every time.
3. may be you have written something wrong in you locator.

check all the possible condition and lets see will above points solve your problem.

Best of luck.

bye
madisonli2007
Posts : 5
Join date : 2010-08-03

Re: selenium.isElementPresent("some_button") is not reliable

on Mon Aug 16, 2010 10:31 pm
Hi,
Thanks for the response. you are right, my id is generated dynamically at runtime, with empty ids.
So, isElementPresent() isn't the root cause. The root cause is that selenium doesn't recognize the dynamic links on the parent page.
On the parent window I have a table that contains a column of links, which each invokes a new window. If I do getAlllLinks(), the returned link IDs are all empty.
metman
Amateur
Amateur
Posts : 58
Join date : 2010-04-02

Re: selenium.isElementPresent("some_button") is not reliable

on Fri Aug 20, 2010 8:02 am
I've found selenium's xpath algorithms to be painfully finnicky myself, but once you find one that works, it always works. Unless you have dynamic ids. Smile Can you rely on the same relative position to another static element? If so, you can locate the link you want with xpath that way.
Sponsored content

Re: selenium.isElementPresent("some_button") is not reliable

Back to top
Permissions in this forum:
You cannot reply to topics in this forum