Skip to content

When building a AppiumDriverLocalService, there is a Port number missmatch when providing --port argument #521

Description

@alexander-poulikakos

Description

When providing the port number via withArgument("--port", "8998") method, there becomes a miss match in ports, i.e. server starts on one port, while java_client tries to connect to another port. In below code example/stackTrace The Appium server is started on port 8998, but the java_client tries to connect to the default port "4723" and times out with an exception.

As can be seen in below stacktrace the port number is added twice in the node arguments.
The given Node.js executable: /usr/local/Cellar/node/5.5.0/bin/node Arguments: [/usr/local/lib/node_modules/appium/build/lib/main.js, --port, 4723, --address, 0.0.0.0, --port, 8998]

Environment

  • java client build version: java_client-4.1.2
  • Appium server version: v1.6.1-beta
  • Desktop OS/version used: MAC OSX 10.11.6
  • Node.js version: v5.5.0
  • Mobile platform/version under test:
  • Real device

Code To Reproduce Issue [ Good To Have ]

package_play;
importjava.util.HashMap;
importjava.util.Map;
importorg.openqa.selenium.remote.DesiredCapabilities;
importio.appium.java_client.ios.IOSDriver;
importio.appium.java_client.remote.MobileCapabilityType;
importio.appium.java_client.service.local.AppiumDriverLocalService;
importio.appium.java_client.service.local.AppiumServiceBuilder;
publicclass_AppiumServerClientPlay {
publicstaticvoidmain(String[] args) {
Map<String, String> env = newHashMap<>(System.getenv());
env.put("PATH", "/usr/local/bin:" + env.get("PATH"));
AppiumDriverLocalServiceserver = newAppiumServiceBuilder()
.withEnvironment(env)
.withArgument(() -> "--port", "8998")
.build();
DesiredCapabilitiescaps = newDesiredCapabilities();
caps.setCapability(MobileCapabilityType.APP, "__/path/to/your.app__");
caps.setCapability(MobileCapabilityType.UDID, "__your_UDID_here__");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Iphone");
newIOSDriver<>(server, caps);
}
}

Ecxeption stacktraces

[Appium] Welcome to Appium v1.6.1-beta
[Appium] Non-default server args:
[Appium] port: 8998
[Appium] Appium REST http interface listener started on 0.0.0.0:8998
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: '******', ip: '*********', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_72'
Driver info: driver.version: IOSDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:145)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:108)
at _play._AppiumServerClientPlay.main(_AppiumServerClientPlay.java:32)
Caused by: io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: /usr/local/Cellar/node/5.5.0/bin/node Arguments: [/usr/local/lib/node_modules/appium/build/lib/main.js, --port, 4723, --address, 0.0.0.0, --port, 8998] Process output: [Appium] Welcome to Appium v1.6.1-beta
[Appium] Non-default server args:
[Appium] port: 8998
[Appium] Appium REST http interface listener started on 0.0.0.0:8998
at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:155)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:65)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 11 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://0.0.0.0:4723/wd/hub/status] to be available after 120003 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
at io.appium.java_client.service.local.AppiumDriverLocalService.ping(AppiumDriverLocalService.java:115)
at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:142)
... 13 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
... 15 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:130)
... 16 more

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions