**即使指定了 9999 以外的端口,winium 驱动程序也会在 9999 上启动。如何更改此默认端口?我正在使用以下代码在 Windows 10 上启动 winium 驱动程序:
我的代码:
public class Outlook_Poc {
public static void main(String[] args) throws IOException {
DesktopOptions option = new DesktopOptions();
option.setApplicationPath("C:/Program Files/Microsoft Office/Office15/outlook.exe");
System.setProperty("webdriver.winium.desktop.driver","C:\\Winium\\Winium.Desktop.Driver.exe");
File driverpath = new File("C:/Downloads for Selenium/Winium.Desktop.Driver/Winium.Desktop.Driver.exe");
WiniumDriverService service = new WiniumDriverService.Builder().usingDriverExecutable(driverpath).usingPort(18434).withVerbose(true).withSilent(false).buildDesktopService();
service.start();
System.out.println("test");
WiniumDriver winDriver = new WiniumDriver(service,option);
winDriver.findElementByName("OK").click();
service.stop();
}
}
Output trace :
Starting Windows Desktop Driver on port 9999
04:32:43 [DEBUG] Waiting for a connection...
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:05:20.749Z'
System info: host: 'DALQEWIN1101', ip: '10.9.109.56', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179)
at test.outlook_poc.main(outlook_poc.java:25)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:18434/status] to be available after 20015 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188)
... 2 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 3 more
--------------