RE: How to open new tab in chromedriver? The following code is not working for chrome driver. Any other ways


Driver().findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL+"t");

Add Comment
4 Answers

Hi amit,
Thanks for your reply.
UsingĀ  “Actions” is not working for my code. TheĀ  following line is working with firefox driver not with chrome driver.

act.sendKeys(Keys.chord(Keys.CONTROL,Keys.TAB)).perform().

I used the following javascript code to open the new tab

JavascriptExecutor jse = (JavascriptExecutor)browser.getDriver();
jse.executeScript(“var w = window.open(); w.document.open();”);

It worked. The problem here is even after i switch the control to new tab (driver.switchto().window(“new tab handle”)) , the actions are happening in my old tab.. any specific reasons??

Default Answered on March 13, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.