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

In Firefox, execution of javascript to get 'tagName' will stuck. #1426

Closed
leiwang008 opened this issue Dec 28, 2015 · 1 comment
Closed

In Firefox, execution of javascript to get 'tagName' will stuck. #1426

leiwang008 opened this issue Dec 28, 2015 · 1 comment

Comments

@leiwang008
Copy link

Environment: webdriver-standalone2.47.1 and Firefox42.0 on windows7.
To get a bunch of properties value, we execute javascript to put the properties [name, value] into a map. For other properties, the execution runs finely, but for property 'tagName', it will stuck. Below is a simple test to reproduce this problem.

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    //DesiredCapabilities capabilities = DesiredCapabilities.chrome();//No problem with CHROME
    //DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();//No problem with IE

    capabilities.setJavascriptEnabled(true);
    //We should start the standalone driver on port 4444 manually.
    WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);

    driver.get("http://www.google.com");
    WebElement searchbox = driver.findElement(By.id("lst-ib"));

    String script = "function getHtmlProperties(domNode){\n"+
            "  var propMap={}; \n"+
            "  if( domNode!=undefined ){\n"+
            //"  propMap['tagname']=domNode.tagName;"+ //with 'tagname' as map key, execution will pass
            "  propMap['tagName']=domNode.tagName;"+ //with 'tagName' as map key, execution will stuck
            "  }\n"+
            "  return propMap;\n"+
            "}\n"+
            "\n return getHtmlProperties(arguments[0]); \n";

    Object result = ((JavascriptExecutor) driver).executeScript(script, searchbox);
    System.out.println(result);

    driver.close();
@barancev
Copy link
Member

Fixed by commit d1e9b27

@lock lock bot locked and limited conversation to collaborators Aug 20, 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

2 participants