Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot initialize AndroidDriver

At W2k8 64 bit I have in the android emulator instance of android 4.1 API Level 16 with ARM as CPU. After launch of it I'm running my UnitTest and on the first line

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

I got an exception:

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)

Version of this WebDriver is 2.25.1.0.

I followed this article:

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

When I'm using other drivers like Firefox- or ChromeDriver works fine.

I would be gratefull for any advice

like image 626
user278618 Avatar asked Oct 04 '12 16:10

user278618


1 Answers

I might be telling you what you already know, but have you started the tcp port forwarding to android server you are running. for reference check Android Driver

like image 84
Prashant Shukla Avatar answered Oct 14 '22 16:10

Prashant Shukla