Monday, 15 May 2017

How to simulate keypress [CONTROL + T] to open new tab using webdriverjs?

I am using webdriverjs now (selenium-webdriver) for test automation. Scenario is such that I need to open a url on one tab and another url on second tab. To open a new tab I am trying to use keypress (Control + T).

Code that I am using looks something like this:

driver.actions().keyDown(webdriver.Key.CONTROL).sendKeys(String.valueOf('\u0064')).keyUp(webdriver.Key.CONTROL).perform();

'\u0064' is Unicode for 'T'

I would be really helpful to know what I am doing wrong and how to open new tab and shift between these tabs using webdriverjs.

(*Note: I am using webdriverjs which is a node module and not Java)



via Pawan Juyal

No comments:

Post a Comment