我的Opera浏览器在网络驱动程序Opera-chromium启动几秒后退出。我安装了Web驱动程序Opera-Chromium(WIN 64位版本0.2.2版本,运行Selenium版本3.0.1)。
代码:
DesiredCapabilities capabilit = DesiredCapabilities.opera();
System.setProperty("webdriver.opera.driver", "C:/browser-drivers/operadriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("C:/Program Files/Opera x64/opera.exe");
capability.setCapability(ChromeOptions.CAPABILITY, options);
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
OperaDriver browser = new OperaDriver(capability);
WebDriver driver = browser;
因此Opera正确启动:
[TestNG] Running:
C:\Users\Gast\AppData\Local\Temp\testng-eclipse-681906726\testng-customsuite.xml
Starting OperaDriver 0.2.0 (ba47709ed9e35ce26dbd960fb5d75be104290d96) on port 11091
Only local connections are allowed.
Nov 18, 2016 11:04:04 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
但几秒钟后,Selenium中出现以下行:
Nov 18, 2016 11:08:01 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
那时Opera退出了。
我尝试了几个Opera版本,但是在Selenium createSession
之后无法使Opera保持打开状态,网络驱动程序本身仍处于打开状态。