2012-10-04 133 views
6

在W2k8 64位我在Android 4.1 API Level 16的ARM仿真器實例中使用ARM作爲CPU。 推出它後我跑我的單元測試,並在第一行無法初始化AndroidDriver

var webDriver = new AndroidDriver("http://localhost:8080/wd/hub"); //also with no argument 

我有一個例外:

Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8080 
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 
    at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) 
    at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) 
    --- End of inner exception stack trace --- 
    at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) 
    at System.Net.HttpWebRequest.GetRequestStream() 
    at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) 
    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) 

webdriver的這個版本是2.25.1.0。

我跟着這篇文章:

http://www.nishantverma.com/2011/06/installing-webdriver-on-android.html

當我使用其他司機一樣Firefox-或ChromeDriver工作正常。

我會gratefull任何意見

回答

1

我可能會告訴你,你已經知道,但你開始的TCP端口轉發到Android服務器正在運行。作爲參考檢查Android Driver

+0

感謝您的回覆。我現在根據http://www.nishantverma.com/2011/06/installing-webdriver-on-android.html的指示完成了這個工作,但我無法連接(404)到http:// localhost:8080/WD /集線器。也沒有溝通「碼頭開始」。當然,代碼中的錯誤仍然是一樣的。 – user278618

0

您的服務器由於某種原因未啓動。是否有可能你已經有其他東西在8080端口上運行?

嘗試運行netstat -a -n並查看端口8080是否已列出。

如果它正在使用中,您可以嘗試在另一個端口上設置或終止正在使用該端口的進程。

你也可以嘗試在你的機器上禁用UAC和防火牆,並且/或者以管理員身份運行這個進程,看看是否有幫助(當然,這是暫時的,不要把它們關閉)。