Unable to locate an element with XPath in selenium webdriver script with C#

In my automation script using selenium webdriver, some elements in the webpage with id:


These are failing to be detected. I tried the following:


I am unable to get any other unique property like @name, @title etc. Please help me.

1 answer

  • answered 2018-02-23 12:38 Chris Brocious

    wherever you are with your driver right before you try to execute your findelement run a print(driver.page_source) or however it's syntax is with C#. make sure that the id actually shows up in the page source, or you'll be looking for days. If you find the page source DOES NOT contain your element... try timing out. Don't use a WebdriverWait command, Implicit, or Explicit command... if you're behind a firewall they won't work any way. Use the thread.sleep() command for 5-10seconds to see if your page_source changes. If it does change, and your id IS found ... just leave the sleep command in your script and it should be able to detect your element.