2

e.g. if I get an instance of an element using

var termsLink = driver.findElement(webdriver.By.id('wd-terms'));

There dont seem to be any methods available on the resulting WebElement object to set focus on the target element, in that case how can I do this using Webdriver JS?

the_velour_fog
  • 2,094
  • 4
  • 17
  • 29

1 Answers1

0

It seems other the java bindings for webdriver have a method moveToElement but looking into the source code of my webdriver instance, "selenium-webdriver": "^2.46.1" obtained via NPM, the moveToElement method doesnt seem to exist.

The best technique I found was

driver.findElement(webdriver.By.id('some-id')).sendKeys('');

per this SO question

Community
  • 1
  • 1
the_velour_fog
  • 2,094
  • 4
  • 17
  • 29