Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

selenium.isElementPresent("some_button") is not reliable

View previous topic View next topic Go down

selenium.isElementPresent("some_button") is not reliable

Post by madisonli2007 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?

madisonli2007

Posts : 5
Join date : 2010-08-03

Back to top Go down

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

Post by Adviser 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

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

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

Post by madisonli2007 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.

madisonli2007

Posts : 5
Join date : 2010-08-03

Back to top Go down

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

Post by metman 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.

metman
Amateur
Amateur

Posts : 58
Join date : 2010-04-02

Back to top Go down

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

Post by Sponsored content Today at 9:04 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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