appium / appium/java-client

Screenshots get swapped between devices when two instances of AppiumDriver are executed in parallel

Open
#1,381 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

User side problem/problem of an external tool
Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

I'm using two instances of AppiumDriver in separate threads for automating a mobile app on two Android devices in parallel. When a test case fails on both the devices, I'm trying to capture a screenshot of the devices using the following code snippet.
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

The screenshots are saved in different directories named after the device names, but sometimes (2 out of 3), the screenshots created get swapped between the devices. That means if I'm using a Tab and a Phone for testing, the screenshot of the Tab gets created inside the directory created for Phone and vice versa.

I'm pretty sure there are two separate instances of AppiumDriver running on different ports as the entire test suit (~100+ tests) runs smoothly on both the devices without a problem. Just the screenshots get swapped between the devices.

Any help or pointers in the right direction are much appreciated.

Environment

  • Java client build version or git revision if you use some snapshot:
  • Appium server version or git revision if you use some snapshot:
  • Desktop OS/version used to run Appium if necessary:
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
  • Mobile platform/version under test:
  • Real device or emulator/simulator:

Source Code

Find a very brief (dirty) representation of my code flow here

Environment

  • Appium version: 1.18.0
  • Desktop OS/version: Mac OS Catalina 10.15.5
  • Node.js version: v12.16.1
  • Npm or Yarn package manager: Npm (v6.13.4)
  • Real device or emulator/simulator: Real Devices
  • Appium CLI or Appium.app|exe: Appium

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked gist and the parallel test flow around getScreenshotAs(OutputType.FILE), then reproduce the issue with two AppiumDriver instances on separate devices. Done means each captured screenshot is consistently saved under the directory for the device that produced it.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.