使用Selenium和Java自动化VM远程控制台

时间:2017-08-22 12:27:07

标签: java selenium-webdriver vmware ui-automation

我正在使用Selenium WebDriver来自动化VMWare HML5。当我到最后启动VM远程控制台时,会出现一条警告消息,我无法检查以单击该消息。有两种选择1)"打开VM Ware远程控制台" 2)"不要打开"我尝试过以下方法:

 Alert alert = driver.switchTo().alert();
 alert.accept();

我收到以下错误:

Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8), userDataDir=C:\Users\USERNAME~1\AppData\Local\Temp\scoped_dir18824_10625}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.101, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: 35b8e59a225daf47796fe483450924f0
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:694)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.alert(RemoteWebDriver.java:1020)
    at browser.VMTasks.launchRemoteConsole(VMTasks.java:624)
    at bro

wser.html5TEST.main(html5TEST.java:80)

我还尝试将Keys发送到TAB以正确选择并输入,因为焦点在于警报,并且当警报存在时,页面的其余部分无法与之交互,但弹出警报没有任何效果。

0 个答案:

没有答案