-1

Hi Please let me know how to Write selenium code for right click on the link and open the link .I am aware that i can use keyboard functions but i am bit confused

  • [See the answer in the link](https://stackoverflow.com/questions/17547473/how-to-open-a-new-tab-using-selenium-webdriver) – H Pat Oct 01 '19 at 11:56

1 Answers1

0

try the following code ... this is the code for right clicking on "About" link which appears in google page.. u can open that in new tab by selecting options in context menu.....

WebDriver driver = new ChromeDriver();
driver.get("http:\\google.com");
WebElement ele= driver.findElement(By.linkText("About"));
Actions ac=new Actions(driver);
Thread.sleep(2000);
ac.contextClick().sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_UP).sendKeys(Keys.ENTER).build().perform();
Thread.sleep(2000);
driver.quit();
dhivya
  • 1
  • 1