How can I locate a New Window button “driver.findElement(By.xpath(“.//*[@id=’tabs-1′]/div/p/a”)).click();”



Practice Exercise – 2

Point 3 is mentioned as below

“Use this statement to click on a New Window button “driver.findElement(By.xpath(“.//*[@id=’tabs-1′]/div/p/a”)).click();””

How can I locate the xpath of New Window button?

Default Asked on April 6, 2017 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)
    Best answer

    After URL( is loaded. By default ‘Open New Window ‘ option which is to left hand side is selected.

    The xpath “.//*[@id=’tabs-1’]/div/p/a” is of the hyperlink ‘New Browser Tab‘.

    You can verify the same using firepath tool.

    Train Answered on May 16, 2017.
    Add Comment
  • Your Answer

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