简体   繁体   English

通过TestComplete连接Appium服务器时指定localhost

[英]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 地址,并且您更愿意使用更友好的机器名称,那么您有两个选择;

Domain Name Services域名服务

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> (不带尖括号)来查看该机器的名称是否已知或可用。

Hosts Alias主机别名

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 地址创建一个友好的别名;

  1. open Notepad as Adminstrator, by right clicking the application and selecting "Open as Administrator"以管理员身份打开记事本,方法是右键单击应用程序并选择“以管理员身份打开”
  2. open C:\Windows\System32\drivers\etc\hosts打开C:\Windows\System32\drivers\etc\hosts
  3. Add a line at the end that reads;在末尾添加一行:
<IP Address> friendlyname # This machine hosts appium
  • again, that's the IP address of the appium system without any angle brackets同样,这是没有任何尖括号的 appium 系统的 IP 地址
  1. You should then be able to use 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.

相关问题 将 sql 数据库连接到服务器(本地主机)时出现未知数据库错误 - Unknown database error when connecting sql database to server (localhost) Xamarin 连接到本地主机时出现错误请求 - Xamarin BadRequest when connecting to localhost 通过本地计算机连接到远程服务器时,Solr端口禁用 - Solr port disable when connecting to remote server through local machine 使用 Alamofire 连接到本地主机服务器(python) - Connecting to localhost server(python) using Alamofire 使用Node.js连接到localhost:3000服务器 - Connecting to a localhost:3000 server with Node.js 与本地主机连接时,android设备上的httpconnection被拒绝 - httpconnection refused on android device when connecting with localhost 使用knex在localhost上连接到Postgresql时出错 - Error when connecting to postgresql on localhost with knex 在未指定端口的情况下在浏览器中进入localhost会发生什么? - What happens when I go to localhost in a browser without specifying a port? 使用Android上的Smack API连接到localhost上的ejabberd XMPP服务器 - Connecting to a ejabberd XMPP server on localhost using Smack API on android 在Android中连接到localhost - Connecting to localhost in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM