Running multiple Appium sessions in a single test

Tiago Mateus

I am automating some tests on real devices using Appium and Cucumber and at the moment I am trying to run 2 Appium sessions a single test, something like:

  • Create an instance of the Driver
  • Do some tasks
  • Quit the driver
  • Create a new instance of the Driver with different capabilities
  • Do some tasks
  • Quit the driver

I am wondering what would be the correct way to implement this in Ruby.

Anyone with experience have any tips/advice or some code examples? Or simply redirect me to some good documentation or code.

barbudito
  1. If you want them to run at the same time you will need to create X "node appium" executions with different ports...

Example:

node appium -p 4723 -bp 4724 -U "Device1_identifier"
node appium -p 4725 -bp 4726 -U "Device2_identifier"

And after that you will have to create two drivers

Java code

DesiredCapabilities capabilities1 = new DesiredCapabilities();
capabilities1.setCapability(...);
driver= new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities1);

DesiredCapabilities capabilities2 = new DesiredCapabilities();
capabilities2.setCapability(...);
driver2= new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4725/wd/hub"), capabilities2);
  1. You could create just one appium server with this argument to override sessions:

Example:

node appium --session-override

And then create a second driver with another capabilities after the you finished with first one...

Java code

DesiredCapabilities capabilities1 = new DesiredCapabilities();
capabilities1.setCapability("udid", "Device1_identifier"); //Not necessary if execution is at the same device
capabilities1.setCapability(...);
driver= new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities1);
//DO THINGS WITH DRIVER HERE  
driver.findElement...
driver.something...
////////////////////////////  

DesiredCapabilities capabilities2 = new DesiredCapabilities();
capabilities2.setCapability("udid", "Device2_identifier"); //Not necessary if execution is at the same device
capabilities2.setCapability(...);
driver= new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities2); //This will override your first Appium driver

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Interactivity between multiple sessions of a single running R Shiny app

Firebase multiple sessions running?

Running a single test works, but running multiple tests fails - Flask and Pytest

Running multiple tensorflow sessions subsequently

Single SSH History for multiple sessions?

AWS single session OR multiple sessions?

Running a single TestNG test on multiple threads simultaneously using Maven

How to have different assertion for a single test running multiple times

Running a single test file

Running a single test in grpc

Running a single integration test/ single test class

Multiple sessions on the same browser for one single webapp

How to start multiple SSH sessions with single password?

Appium test launch fails on multiple devices

parametrize and running a single test in pytest

How to kill running sessions of a user in oracle with single sql query?

How to kill Appium sessions on Appium server

Error while running multiple Tensorflow sessions in the same Python process

How does Spring Session support multiple sessions within a single browser?

Query to only grab entities with multiple sessions in a single date?

Multiple PHP Web Servers to Share a Single Redis Server for User Sessions

Separate login sessions for multiple subdomains in a single flask app

Running multiple commands for npm test

Junit multiple setup and single test

Nunit Test Order - Single Test - Multiple Orders

Can I stop Resharper creating multiple test sessions?

Running only one single test with CMake + make

Running single test class or group with Surefire and TestNG

Running a single test in maven -> No tests were executed!

TOP Ranking

HotTag

Archive