Setup Selenium GRID to Execute Appium Script on IOS Simulator or Device from Remote Machine

Lets take an example of 2 machines mentioned below :

Machine 1 : Windows OS (will be acting as a HUB)

Machine 2 : MAC OS (Will be acting as a node)

Follow steps mentioned below :

Machine 1 Setup (IP Address : (WIndows OS)

1. Download Selenium Standalone server and save it in a folder


2. Open command prompt, navigate to the location where selenium JAR is saved and start Hub using following command

cd gridsetup

java -jar selenium-server-standalone-3.4.0.jar -role hub

NOTE : As HUB port is not mentioned in above command, so it will be started on 4444 by default


After executing above command, invoke following URL to check Hub is started or not


Eg :


Machine 2 Setup (IP Address : (MAC OS)

1. Download Selenium Standalone server and save it in a folder.

2. Install Appium and start the server by using below command.
NOTE : Refer this doc to Install Appium via Terminal
Here, we are using Appium version 1.6.4

appium --port 4723 --address

After executing above command, Appium server will get started on port 4723


3. Now is the time to Register a node. Before registering a node to a HUB, first you have to create JSON file and save it in a folder where selenium stand alone jar is saved.


Sample JSON code

    "capabilities": [
            "browserName": "iPhone-Simulator",
            "version": "10.3",
            "maxInstances": 1,
            "seleniumProtocol": "WebDriver"
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "url": "",
        "host": "",
        "port": 4723,
        "maxSession": 5,
        "register": true,
        "registerCycle": 5000,
        "role": "node",
        "hub": "",
        "hubPort": 4444,
        "hubHost": "",
        "debug": false,
        "servlets" : [],
        "withoutServlets": [],
        "custom": {}

You have to update the above JSON code accordingly. Just Refer below details while updating JSON:

"browserName": "<e.g._iPhone5_or_iPad4>",

"host": <host_name_appium_server_or_ip-address_appium_server>,
"port": <appium_port>,
"hubPort": <grid_port>,
"hubHost": "<Grid_host_name_or_grid_ip-address>"

4. Open Terminal in MAC OS, navigate to the folder where selenium selenium JAR and JSON file is saved and execute following command to register node with Hub Machine

cd lib

java -jar selenium-server-standalone-3.4.0.jar -role node -hub -nodeConfig config-iphone.json

You have to update the above command accordingly. Just refer below details while updating above command :

-nodeConfig <filename>
-hub <Hub Machine IP Address>


5. After executing above command, node will get registered to HUB. Just check it by invoking following URL :


Grid set up is done. Next step is to execute Appium script on IOS simulator or device from Remote Machine

Below sample code will be executed on IOS Simulator in Machine 2 (MAC OS)

6. Now, execute below code from Machine 1( Windows OS) and it will executed on IOS simulator in Machine 2 (MAC OS)

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class Tests {

	static RemoteWebDriver driver;
	DesiredCapabilities capabilities;

	public void setUp() throws Exception {
		capabilities = DesiredCapabilities.safari();
		capabilities.setCapability("automationName", "XCUITest");
		capabilities.setCapability("platformName", "iOS");
		capabilities.setCapability("platformVersion", "10.3");
		capabilities.setCapability("deviceName", "iPhone 6s");
		capabilities.setCapability("browserName", "Safari");
		capabilities.setCapability("launchTimeout", 120000);

		URL url = new URL(""); //IP Address of Appium Server
		driver = new RemoteWebDriver(url, capabilities);
		driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);


	public void webTest1() {
		String email = "";

	WebElement getElement(By locator) {
		WebDriverWait wait = new WebDriverWait(driver, 20);
		WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
		return element;


	public void tearDown() {

If you really like the information provided above, please don’t forget to like us on Facebook, you can also leave the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *