Ask a Question

I am using waitelement but it is not working

Occasional Contributor

I am using waitelement but it is not working

var encryp=page.WaitElement("//input[contains(@id,'rdbSecurityTrue')]", 15000).Exists


I am using above line of code to wait for the element but when running the script it doesn't wait and it's boolean value is always false.

But xpath is correct if i put hard code delay and run it is running fine but not with waitelement.

Esteemed Contributor

Can you share the context of where you're using this code?

Keep in mind, that it will wait 15 seconds and, if the object is not present within those 15 seconds, it will return a "false" result.  So, it COULD be that you're just not waiting long enough.  Have you tried increasing the timeout value?

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Occasional Contributor

var encryp=page.WaitElement("//input[contains(@id,'rdbSecurityTrue')]", 15000).Exists
if (encryp==true){

above is the piece of code encryp value always comes false. one more thing is that from this condition is a new page before the condition page was different and it doesn't wait even sec to check it seems as scripts stops immediately.

Trusted Contributor

Try increasing the timeout value as what @tristaanogre had mentioned. Increasing from 15000 to like 30000.


Does your XPath object you are searching for, actually exist in page object?


Is this a secure sign-in page and you are waiting for an element to appear? If yes, then TC may not be able to access protected resources.

Showing results for 
Search instead for 
Did you mean: