Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When executeScript popping up javascript alerts, test hangs on InternetExplorer #3560

Closed
sharathpeddapally opened this issue Feb 22, 2017 · 1 comment

Comments

@sharathpeddapally
Copy link

sharathpeddapally commented Feb 22, 2017

Steps to reproduce -

Execute the following java code


public static void main(String a[]) {
        System.setProperty("webdriver.ie.driver", "<your-folder>\\IEDriverServer.exe");
        WebDriver driver = null;
        try {
            driver = new InternetExplorerDriver();
            driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
            driver.get("https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_alert");

            // Hangs here for InternetExplorerDriver
            Object hello = ((JavascriptExecutor) driver)
                    .executeScript("document.getElementById('iframeResult').contentDocument.getElementsByTagName('button')[0].click(); return 'hello';");
            System.out.println("return from javascript : " + hello);

            Thread.sleep(2000);
            WebDriverWait wait = new WebDriverWait(driver, 10);
            wait.until(ExpectedConditions.alertIsPresent());
            Alert alert = driver.switchTo().alert();
            alert.dismiss();
            driver.switchTo().defaultContent();
        } catch (Throwable e) {
            e.printStackTrace();
        } finally {
            if (driver != null) {
                driver.close();
                driver.quit();
            }
        }
    }

Meta -

OS: Windows 7

Selenium Version: 3.0.1

Browser: Internet Explorer

Browser Version: Internet Explorer 11

Expected Behavior -

The program should navigate to the specified URL, click on the button, alert popup, Print "hello" in the console, accept the alert and exit.

Actual Behavior -

The program hangs at the line where the javascript is being executed. The driver instance is blocked for some reason.

@sharathpeddapally sharathpeddapally changed the title Hang on InternetExplorer when executeScript popping up javascript alerts When executeScript popping up javascript alerts, test hangs on InternetExplorer Feb 22, 2017
@jimevans
Copy link
Member

Known limitation of the IE driver. This cannot and will not be fixed.

@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants