1

I have a menu and sub-menus built in angularJS.

Each menu has the following code:

<a class="ng-scope" ng-click="irPara(item, $event)" ng-if="!item.heading" title="">

When I try to click in a link of a submenu, Selenium throws an exception that Element is not clickable, or element is not found.

I assume this happens because I have to wait submenu be load, how Do I wait for this submenu to be loaded without using Thread.sleep()

thanks

Guy
  • 46,488
  • 10
  • 44
  • 88
Rogger
  • 65
  • 2
  • 8

1 Answers1

2

You can use explicit wait. Work around in JavaScript:

driver.wait(function() {
    return driver.findElement(locator).isDisplayed();
}, 10);

This will wait up to 10 seconds for the element to be displayed.

Guy
  • 46,488
  • 10
  • 44
  • 88