not able to select option open link in new tab in right click using selenium

前端 未结 1 1799
既然无缘
既然无缘 2021-01-17 08:10

Summary : Link is not getting open in new tab.

Here is my code with the real url :-

WebDriver driver = new FirefoxDriver();
driver.manage().timeouts(         


        
1条回答
  •  一整个雨季
    2021-01-17 08:35

    First off, uninstall the existing Fire fox and delete the profile and then install the ESR version of Firefox, ESR version is must! To get the ESR version, simply type Firefox ESR in your google, that will pave the way for you to installation file.

    Here is the code

            FirefoxOptions foptions = new FirefoxOptions();
            foptions.setCapability("marionette", false);
            WebDriver driver = new FirefoxDriver(foptions);
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            driver.navigate().to("https://us.justdial.com/NY/New-York/Afghani-Restaurants/ct-16110200");
            WebElement rightclickelement = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div/section/div[5]/div[2]/div[2]/ul/li[1]/div/div[2]/h2/a"));
            Actions action = new Actions(driver);
            action.contextClick(rightclickelement).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform();
    

    0 讨论(0)
提交回复
热议问题