Amey
Amey

Reputation: 8548

How to connect iphone emulator to selgrid 2?

I have done all the steps listed here to setup a webdriver backed iphone emulator. I am also able to run my scripts of the emulator when running them locally using the below code while creating my driver instance.

driver = Selenium::WebDriver.for :remote, :url => "http://localhost:3001/wd/hub", :desired_capabilities => :iphone

What I intend to do is connect this emulator to sel grid 2, which has the hub running remotely on a windows machine.

Can some one please share the command to start the selenium webdriver node on the mac machine(coincidentally my local machine).

Some thing like

java -jar selenium-server-standalone-2.21.0.jar -role webdriver -hubHost remotewindowmachine.com -hubPort 4444 -hub http://remotewindowmachine.com:4444/grid/register -host iphoneIP/hub -port 3001 -browser browserName=iphone

which throws an error

Exception in thread "main" java.net.BindException: Selenium is already running on port 3001.

Which seems kind of obvious, but i am confused as to whats to be done about it.

So can someone help me out?

Upvotes: 2

Views: 976

Answers (1)

A.J
A.J

Reputation: 4949

You dont have to run the node registration command to register it in a grid.

The reason for your error

In iPhone(and emulator) when you start iWebDriverApp it starts in port 3001 as remote control. So when you try to start another node in the same machine on same port(3001) its going to throw this error.

The solution

I have not tried it in an emulator, but in the actual device. After installing the iWebDriverApp in your device, you need to set the hub details for the app. This can be done by going to Settings->iWebDriverApp. you will find textboxes to specify Hub URL and the port. Then restart the iWebDriverApp again. Your iphone will be in the grid.

Upvotes: 2

Related Questions