我无法使用C#连接到在控制台中运行的Appium服务器

时间:2019-07-28 07:22:58

标签: c# appium

服务器Appium在控制台中工作,但是我无法连接到它。如果我运行的是桌面版Appium,则代码可以正常工作。 代码C#

DesiredCapabilities cap = new DesiredCapabilities(); 
cap.SetCapability("deviceName", "device"); 
cap.SetCapability("udid", "127.0.0.1:62028");
cap.SetCapability("platformVersion", "5.1.1");
cap.SetCapability("platformName", "Android");
cap.SetCapability("appPackage", "com.instagram"); 
cap.SetCapability("appActivity", "com.instagram"); 

AndroidDriver<IWebElement> driver = new AndroidDriver<IWebElement>(new 
Uri("http://0.0.0.0:4543/wd/hub"), cap); 
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));

错误代码:

    CSharp OwnCode. Unexpected error. System.Net.WebException: cannot to connect. System.Net.Sockets.SocketException: server address is incorrect
   в System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   в System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   в OpenQA.Selenium.Appium.Service.AppiumCommandExecutor.Execute(Command commandToExecute)
   в OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)


Install Node.js
Install Appium from console

0 个答案:

没有答案