[英]Specifying localhost when connecting to Appium server through TestComplete
I am trying to connect my computer running TestComplete to a different computer running an Appium server.我正在尝试将运行 TestComplete 的计算机连接到运行 Appium 服务器的另一台计算机。 Currently, I am finding the IP address of the Appium computer via Settings -> WiFi -> Details -> IP Address.目前,我通过设置 -> WiFi -> 详细信息 -> IP 地址找到 Appium 计算机的 IP 地址。 Then, I throw this address into TestComplete's 'Connect to Device' Server URL. This looks like "http://01.23.456.789:4723/wd/hub".然后,我将此地址放入 TestComplete 的“连接到设备”服务器 URL。这看起来像“http://01.23.456.789:4723/wd/hub”。 I want to change it to use 'local' host instead of the direct IP Address as mentioned in this question: I have to specify my local Appium server URL. Where/How can I find the URL?我想将其更改为使用“本地”主机而不是此问题中提到的直接 IP 地址: 我必须指定我的本地 Appium 服务器 URL。我在哪里/如何找到 URL? . .
When I change my Server URL in TestComplete to looks like: "http://localhost:4723/wd/hub" I get the error: "A connection with the server could not be established".当我将 TestComplete 中的服务器 URL 更改为:“http://localhost:4723/wd/hub”时,我收到错误:“无法建立与服务器的连接”。 When starting Appium, the host looks like: "0.0.0.0".启动 Appium 时,主机看起来像:“0.0.0.0”。 Leaving this as is and changing it to "localhost" both do not fix my issue.保持原样并将其更改为“本地主机”都不能解决我的问题。 What else is needed in addition to the previously mentioned stack overflow question do I need to do to fix my issue?除了前面提到的堆栈溢出问题之外,我还需要做什么来解决我的问题?
localhost only works for devices connected directly to the TC machine. localhost 仅适用于直接连接到 TC 机器的设备。
When the machine running TestComplete uses localhost
to start a connection, it is sending a request to itself.当运行 TestComplete 的机器使用localhost
启动连接时,它正在向自己发送请求。 Since the appium service isn't running on the same machine as TestComplete, that request will fail.由于 appium 服务不在与 TestComplete 相同的机器上运行,该请求将失败。
If what you want to avoid is using an IP address, and you'd rather use more friendly machine names, then you have two options;如果您想避免使用 IP 地址,并且您更愿意使用更友好的机器名称,那么您有两个选择;
If your.network is using an internal name service (DNS) then each machine probably already has a proper name as well as an IP address.如果 your.network 使用内部名称服务 (DNS),那么每台机器可能已经有一个正确的名称以及一个 IP 地址。 You can ask your.network admin or use tracert <IP address>
(without the angle brackets) to see if a name for that machine is known or available.您可以询问您的网络管理员或使用tracert <IP address>
(不带尖括号)来查看该机器的名称是否已知或可用。
If no name is set within the.network, then you can create a friendly alias for that IP Address within the Hosts file of the machine running TestComplete;如果在 .network 中没有设置名称,那么您可以在运行 TestComplete 的机器的 Hosts 文件中为该 IP 地址创建一个友好的别名;
C:\Windows\System32\drivers\etc\hosts
打开C:\Windows\System32\drivers\etc\hosts
<IP Address> friendlyname # This machine hosts appium
http://friendlyname:4723/wd/hub
from TestComplete to reference the Appium server然后,您应该能够使用http://friendlyname:4723/wd/hub
来自 TestComplete 来引用 Appium 服务器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.