3

I am trying Appium using Python language. And I have a simple script on Python for Android (just open app, find text and assert this text). I want to run this test on several devices.

What I already did:

I have created two Android emulators. Run Selenium Grid hub. Create two configuration files for each emulator and run 2 Appium servers:

hub

java -jar selenium-server-standalone-2.53.0.jar -role webdriver -nodeConfig emulator-5554.json -hub http://127.0.0.1:4444/grid/register

Appium servers:

appium --address 127.0.0.1 --port 4721 -bp 2253 --udid emulator-5554 --nodeconfig C:\SeleniumGrid\Android\emulator-5554.json

and

appium --address 127.0.0.1 --port 4722 -bp 2254 --udid emulator-5556 --nodeconfig C:\SeleniumGrid\Android\emulator-5556.json

My JSON configuration files:

first:

{  "capabilities":
      [
        {
          "deviceName": "emulator-5554",
          "browserName":"Browser", 
          "version":"6.1",
          "maxInstances": 1,
          "platform":"ANDROID"
        }
      ],
  "configuration":
  {
    "cleanUpCycle":2000,
    "timeout":30000,
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "url":"http://127.0.0.1:4721/wd/hub",
    "host": "127.0.0.1",
    "port": 4721,
    "maxSession": 10,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": "127.0.0.1"
  }
}

second:

{  "capabilities":
      [
        {
          "browserName":"Browser",  
          "deviceName": "emulator-5556",
          "version":"4.4.4",
          "maxInstances": 1,
          "platform":"ANDROID"
        }
      ],
  "configuration":
  {
    "cleanUpCycle":2000,
    "timeout":30000,
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "url":"http://127.0.0.1:4722/wd/hub",
    "host": "127.0.0.1",
    "port": 4722,
    "maxSession": 10,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": "127.0.0.1"
  }
}

And my setUp method:

def setUp(self):
        desired_caps = {}
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = 'platformVersion'
        desired_caps['deviceName'] = 'deviceName'

        desired_caps['app'] = 'oneDo.apk'

        self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)

How can I run this one test on several devices? Any ideas?

Vadim Kovrizhkin
  • 1,575
  • 4
  • 16
  • 27

0 Answers0