Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium IE在测试套件执行时不断地最大化和最小化_Selenium_Internet Explorer 8_Automation_Webdriver_Selenium Webdriver - Fatal编程技术网

Selenium IE在测试套件执行时不断地最大化和最小化

Selenium IE在测试套件执行时不断地最大化和最小化,selenium,internet-explorer-8,automation,webdriver,selenium-webdriver,Selenium,Internet Explorer 8,Automation,Webdriver,Selenium Webdriver,我正在使用 Selenium独立服务器-2.25.0 IE-8.0.7601.17514(64位版本) IEDriverServer.exe-2.28.0(64位) 操作系统-Windows 7专业版 Java-SDK7 我使用下面的代码来启动IE并运行一个简单的测试 WebDriver driver = null; DesiredCapabilities ieCapabilities = null; ieCapabilities = DesiredCapabilitie

我正在使用
Selenium独立服务器-2.25.0
IE-8.0.7601.17514(64位版本)
IEDriverServer.exe-2.28.0(64位)
操作系统-Windows 7专业版
Java-SDK7

我使用下面的代码来启动IE并运行一个简单的测试

    WebDriver driver = null;
    DesiredCapabilities ieCapabilities = null;
    ieCapabilities = DesiredCapabilities.internetExplorer();
    if (ieCapabilities != null) {
        driver = new InternetExplorerDriver(ieCapabilities);
    }
    driver.get("http://www.yebhi.com/");
    // driver.findElement(By.id("anchSighin")).click();

    driver.findElement(By.xpath("//div/ul/li/a/div/span")).click();
    driver.findElement(By.xpath("//div[80]/a")).click();
    driver.findElement(By.xpath("//div[4]/div/div[2]/div/div[4]/a"))
            .click();
    Thread.sleep(5000);
    driver.findElement(By.xpath("//div[5]/div[4]/div/div[4]/a")).click();
    driver.switchTo().frame(2);
    driver.findElement(By.id("txtMoblogin")).clear();
    driver.findElement(By.id("txtMoblogin")).sendKeys("ghfghghf");
    driver.findElement(By.id("txtMobPass")).clear();
    driver.findElement(By.id("txtMobPass")).sendKeys("hfghgh");
    Thread.sleep(5000);
    driver.findElement(By.id("btnLogin")).click();
通过使用上述代码,我能够启动并运行测试,但出现了一个问题。
实际问题是
浏览器不断地最大化和最小化,直到测试套件完成。

我为这个问题挣扎了一个多星期。我不知道它是不是虫子。如果这是一个错误,请解决我


提前感谢。

IE驱动程序正在调整IE窗口的大小,因为您正在拍摄屏幕截图。It WebDriver,根据定义,屏幕截图是整个页面的一部分。但是,为了在不滚动的情况下拍摄完整页面的屏幕截图(这会破坏绝对定位的元素),您必须能够在IE中呈现完整页面。要呈现完整页面的唯一方法是调整IE窗口的大小,以便在不滚动的情况下可以看到完整页面。因此,IE驱动程序会自动调整屏幕截图API调用的大小,然后将窗口恢复到调用前的状态。

您(明确地或通过框架中的方法)是在途中拍摄浏览器的屏幕截图吗?@Jim:是的,我用这种方式拍摄屏幕截图
scrFile=((TakesScreenshot)driverOne.getScreenshotAs(OutputType.FILE);copyFile(scrFile,“myPath”)clear()
就是其中之一),但这已在IEDriverServer.exe的2.26.1中得到解决。谢谢您的回答。你为我节省了很多时间。有没有办法克服这个问题?简单地说,我想在不调整窗口大小的情况下拍摄每个动作的屏幕截图。不幸的是,不是IE。这是浏览器渲染的限制,不是WebDriver。有趣。如果您需要屏幕截图而没有“调整大小”的副作用,您可以使用Sikuli api。