New issue
Advanced search Search tips

Issue 913131 link

Starred by 3 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug

Blocking:
issue chromedriver:2691



Sign in to add a comment

Switching to a new tab by using of WebDriver hangs

Project Member Reported by khachatryan@chromium.org, Dec 7

Issue description

Switching to a new tab by using of WebDriver hangs

The following Java code reproduces the issue:

    public void tabBreaker() throws Exception{
        System.setProperty("webdriver.chrome.driver", "/<path>/chromedriver");
        System.setProperty("webdriver.chrome.logfile", "/<path>/ Issue2691 .log");
        ChromeOptions options = new ChromeOptions();
        options.setBinary("/<path>/chrome");
        System.setProperty("webdriver.chrome.verboseLogging", "true");
        DesiredCapabilities streetcar = DesiredCapabilities.chrome();
        LoggingPreferences logPrefs = new LoggingPreferences();
        logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
        streetcar.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
        HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
        options.setExperimentalOption("prefs", chromePrefs);
        options.addArguments("enable-automation");
        options.addArguments("--no-sandbox");
        options.addArguments("--disable-infobars");
        options.addArguments("--disable-dev-shm-usage");
        options.addArguments("--disable-browser-side-navigation");
        options.addArguments("--disable-gpu");
        options.addArguments("--dns-prefetch-disable");
        streetcar.setCapability(ChromeOptions.CAPABILITY, options);
        ChromeDriver driver = new ChromeDriver(streetcar);
        driver.manage().window().setSize(new Dimension(1024, 1024));
        WebDriverWait waiting = new WebDriverWait(driver, 60);

        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        String handleitem = tabs.get(0);
        driver.get("https://jsfiddle.net/z3Lymxeg/1/");
        waiting.until(ExpectedConditions.not(ExpectedConditions.numberOfElementsToBe(By.className("resultsPanel"), 0)));

        driver.switchTo().frame(driver.findElement(By.name("result")));
        assertEquals(driver.findElements(By.id("newwindow")).size() > 0, true);
        Thread.sleep(2000); //Because of JS fiddle's pixel num display, which tends to cover the button it tries to click,
        driver.findElement(By.id("newwindow")).click();
        waiting.until(ExpectedConditions.numberOfWindowsToBe(2));
        tabs = new ArrayList<String>(driver.getWindowHandles());
        handleitem = tabs.get(1);

        for(String handle : driver.getWindowHandles())
        {
            if(handle.equals(handleitem))
            {
                driver.switchTo().window(handle);
                break;
            }
        }        
        waiting.until(ExpectedConditions.urlToBe("https://www.youracclaim.com/"));
        Thread.sleep(2000);
        driver.quit();
    }


Commit r584254 causing this issue.

 
Cc: johnchen@chromium.org
Status: Available (was: Untriaged)
Status: Untriaged (was: Available)
Available, but no owner or component? Please find a component, as no one will ever find this without one.

Sign in to add a comment