无法更改Winium驱动程序中的默认端口

时间:2018-10-16 08:51:31

标签: selenium selenium-webdriver winium

**即使指定了除9999以外的端口,winium驱动程序仍从9999启动。如何更改此默认端口?我正在使用以下代码在Windows 10上启动Winium驱动程序:

Code:**

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
--------------

0 个答案:

没有答案