diff --git a/lib/webdriveragent.js b/lib/webdriveragent.js index c69666f4e..f5cda7ee3 100644 --- a/lib/webdriveragent.js +++ b/lib/webdriveragent.js @@ -58,7 +58,8 @@ export class WebDriverAgent { this.setWDAPaths(args.bootstrapPath, args.agentPath); this.wdaLocalPort = args.wdaLocalPort; - this.wdaRemotePort = args.wdaLocalPort || WDA_AGENT_PORT; + this.wdaRemotePort = ((this.isRealDevice ? args.wdaRemotePort : null) ?? args.wdaLocalPort) + || WDA_AGENT_PORT; this.wdaBaseUrl = args.wdaBaseUrl || WDA_BASE_URL; this.prebuildWDA = args.prebuildWDA;