Forum Discussion

ashutosh01's avatar
ashutosh01
Contributor
12 months ago

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.

3 Replies

  • tristaanogre's avatar
    tristaanogre
    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?

    • ashutosh01's avatar
      ashutosh01
      Contributor

      var encryp=page.WaitElement("//input[contains(@id,'rdbSecurityTrue')]", 15000).Exists
      Log.Message(encryp)
      if (encryp==true){
      page.FindChildByXPath("//input[@id='rdbSecurityTrue']").Click();
      page.FindChildByXPath(".//*[@id='sslSecurityFalse']").Click();
      }

      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.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    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.