zoukankan      html  css  js  c++  java
  • Selenium Web Driver [IE only] All web elements are frozen after logon

    [Environment]
    Selenium version: selenium-server-2.26.0
    OS: Windows 7 Ultimate (both 32 bit and 64 bit)
    Browser: IE 9 and IE8
    Browser version: IE9/8
    
    [Related Issue]
    Just a reference: This issue was found together with Issue4823 (http://code.google.com/p/selenium/issues/detail?id=4823). They may have some connections or not.
    
    
    [What steps will reproduce the problem]
    1. Use the following to create IE driver:
         --------------------------
            //Use IE driver
            File file = new File("E:/SW/Selenium/IEDriverServer32.exe");
            System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
            DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
            capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
            capabilities.setCapability("ignoreProtectedModeSettings",true);
            driver = new InternetExplorerDriver(capabilities);
            baseUrl = "http://10.1.3.12/";
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    
    2. Use following code to open Login page, input username and password:
         --------------------------
            driver.get(baseUrl);
            driver.findElement(By.id("username")).sendKeys("admin");
            driver.findElement(By.id("password")).sendKeys("admin");
    
    3. Use the following to click the Submit button to login.
         --------------------------
            driver.findElement(By.id("login_submit")).click();
    
    [What is the expected output]
         After click Submit, it can logon, and all the web elements still work in logged on UI.
    
    [What do you see instead]
         1. After click Submit button, it can logon. But all the UI elements in the logged on page are frozen. Click on any of them, no response.
         2. If use the following code to replace Steps 3 (i.e. driver.findElement(By.id("login_submit")).click()), after logon, all UI elements work as expected.
         --------------------------
            JavascriptExecutor js = (JavascriptExecutor) driver;
            js.executeScript("document.getElementById(\"login_submit\").click()",true);  
    
    [Additional Information]
    This issue does NOT occur on Firefox.

    Answer:
    if "UI elements in the logged on page are frozen" means "i can not interact with page manually" try set "enablePersistentHover" desired capabilities to false

    The whole code

    package com.example.tests;
    
    import java.io.File;
    import java.util.regex.Pattern;
    import java.util.concurrent.TimeUnit;
    import org.junit.*;
    import static org.junit.Assert.*;
    import static org.hamcrest.CoreMatchers.*;
    import org.openqa.selenium.*;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.ie.InternetExplorerDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.support.ui.Select;
    
    public class BenbriaSele01 {
        private WebDriver driver;
        private String baseUrl;
        private StringBuffer verificationErrors = new StringBuffer();
        @Before
        public void setUp() throws Exception {
            
            
            //Use IE driver
            File file = new File("E:/SW/Selenium/IEDriverServer32.exe");
            System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
            DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
            capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
            capabilities.setCapability("ignoreProtectedModeSettings",true);
            capabilities.setCapability("enablePersistentHover", false);
            driver = new InternetExplorerDriver(capabilities);
            
    
            
    //        //Use Firefox
    //        driver = new FirefoxDriver();
    
            
            baseUrl = "http://10.1.3.12/";
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            
        }
    
        @Test
        public void testBenbriaSele01() throws Exception {
            driver.get(baseUrl);
            driver.findElement(By.id("username")).sendKeys("admin");
            driver.findElement(By.id("password")).sendKeys("admin");
            driver.findElement(By.id("login_submit")).click();
    //        JavascriptExecutor js = (JavascriptExecutor) driver;
    //        js.executeScript("document.getElementById(\"login_submit\").click()",true);
        }
    
    //    @After
    //    public void tearDown() throws Exception {
    //        driver.quit();
    //        String verificationErrorString = verificationErrors.toString();
    //        if (!"".equals(verificationErrorString)) {
    //            fail(verificationErrorString);
    //        }
    //        System.out.println("tearDown!");
    //    }
    
    }

    Done.
  • 相关阅读:
    输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不可能是该压栈序列的弹出序列。(注意:这两个序列的长度是相等的)
    输入两棵二叉树A,B,判断B是不是A的子结构。(ps:我们约定空树不是任意一个树的子结构)
    输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。
    输入一个链表,反转链表后,输出链表的所有元素。java实现
    少一点虚荣,多一点务实
    Mysql存储引擎__笔记
    osi七层模型和两主机传输过程:
    redis_笔记
    zookeeper_笔记
    rest和soap_笔记
  • 原文地址:https://www.cnblogs.com/backpacker/p/2791151.html
Copyright © 2011-2022 走看看