Java Selenium 3.0.1-Safari 10 Webdriver-设置位置后无窗口异常
我的Selenium节点启动并成功注册到我的Selenium网格。然后,当中心授权运行测试时,打开一个新的safari窗口,加载我们的页面,然后挂起,保持页面打开并引发NoSuchWindowException。控制台输出如下:Java Selenium 3.0.1-Safari 10 Webdriver-设置位置后无窗口异常,java,selenium,safari,webdriver,Java,Selenium,Safari,Webdriver,我的Selenium节点启动并成功注册到我的Selenium网格。然后,当中心授权运行测试时,打开一个新的safari窗口,加载我们的页面,然后挂起,保持页面打开并引发NoSuchWindowException。控制台输出如下: INFO - The node is registered to the hub and ready to use INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneT
INFO - The node is registered to the hub and ready to use
INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000
INFO - Executing: [new session: Capabilities [{browserName=safari, version=, platform=ANY}]])
INFO - Creating a new session for Capabilities [{browserName=safari, version=, platform=ANY}]
INFO - Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
INFO - Detected dialect: OSS
INFO - Done: [new session: Capabilities [{browserName=safari, version=, platform=ANY}]]
INFO - Executing: [implicitly wait: 15000])
INFO - Done: [implicitly wait: 15000]
INFO - Executing: [get: TEST_PAGE_URL]
INFO - Done: [get: TEST_PAGE_URL]
INFO - Executing: [implicitly wait: 15000])
INFO - Done: [implicitly wait: 15000]
INFO - Executing: [set window position])
WARN - Exception thrown
org.openqa.selenium.NoSuchWindowException: A request to use a window could not be satisfied because the window could not be found. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15 milliseconds
after some system information :
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.setPosition(RemoteWebDriver.java:852)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWindow.setPosition(EventFiringWebDriver.java:628)
at org.openqa.selenium.remote.server.handler.SetWindowPosition.call(SetWindowPosition.java:53)
at org.openqa.selenium.remote.server.handler.SetWindowPosition.call(SetWindowPosition.java:27)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
WARN - Exception: A request to use a window could not be satisfied because the window could not be found. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15 milliseconds
以下是初始化webDriver并导致调用setPosition的一系列方法,其中出现了问题:
private void initTest(String testName, String testPage)
{
WebDriver driver = this.createDriver(testName, testPage);
..........
}
private WebDriver createDriver(String testName, String testPage)
{
WebDriver driver = null;
driver = createRemoteDriver(webDriverName, testPlatform);
initDriver(driver, testPage, testName);
return driver;
}
private void initDriver(WebDriver driver, String testPage, String testName)
{
final String TEST_PAGE_URL = deployUrl + testPage;
driver.get(TEST_PAGE_URL);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().setPosition(DEFAULT_ORIGIN);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().setSize(DEFAULT_BROWSER_SIZE);
.........
}
我正在运行OSX Sierra、Selenium 3.0.1服务器JAR和Selenium 3的新Safari 10 Webdriver,如下所述:
在初始化驱动程序之后,我尝试添加隐式等待等,以防在各种其他情况下,可能是时间问题导致了此异常,不幸的是,没有看到任何差异
我不知道在Selenium尝试设置其位置时,我的页面是否还没有完全加载,但是如果这是问题的话,我会期望添加隐式等待来修复它
总之,这是Safari 10 web驱动程序的已知问题,还是其他人遇到的问题