0

I am testing my company's web application using webdriver. Some of the page parts are populated through javascript and jQuery dynamically. I am not able to locate the elements ID.e elements

dinotom
  • 4,990
  • 16
  • 71
  • 139
Naveen M
  • 1
  • 1
  • wait till page loaded completely – Iftikar Urrhman Khan Apr 26 '16 at 06:44
  • Assuming you need to get the ID of dynamically-inserted elements, if you have control over other scripts you could to attach your script's execution as callback at the end of the execution of other scripts. Otherwise, you could use a `setTimeout` for delaying your script execution and make it happen later than other scripts. Does this address the issue? If not, please be more specific – reallynice Apr 26 '16 at 07:04

1 Answers1

0

If your site uses jQuery then you need to wait till it's executed. You have to check this condition of JS: jQuery.active == 0

To do in in Selenium use the next code:

var ajaxIsComplete = ((bool)((IJavaScriptExecutor) Driver).ExecuteScript("return jQuery.active == 0"));

You can check more implementations in this topic: wait for an ajax call to complete with Selenium 2 web driver

Community
  • 1
  • 1
Denis Koreyba
  • 3,144
  • 1
  • 31
  • 49