question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebDriverAgent runner cannot be activated with activateApp

See original GitHub issue

Problem

Hello. I am trying to activate the WebDriverAgent app in iOS with no luck. What I want to do is open it and set something to clipboard and then bring my own app back.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.21
  • Desktop OS/version used to run Appium: MacOS
  • Mobile platform/version under test: iOS 14.6
  • Real device or emulator/simulator: iPhone XS
  • Appium CLI or Appium.app|exe: Appium CLI

Details

Before the iOS 14.6 I could set something to clipboard, without activating the WebDriverAgent, even thought the documentation advised for the opposite. Now after the upgrade, I followed the instructions to bring the WDA in foreground but a timeout occurs and nothing happens. Also, the same happens if I try to activate another app with the activateApp command, after the first timeout.

Link to Appium logs

https://gist.github.com/nikoskyr/41063dd279f6ee410b6f25ccf32da140

Code To Reproduce Issue [ Good To Have ]

driver().activateApp("com.facebook.WebDriverAgentRunner"); I also tried to change the WDA bundleId but the same problem happened.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
KazuCocoacommented, Jun 27, 2021

I tried with some iOS versions (15, 14.6 and 12.5.4(recent update for iOS 12)), iPad 15 and Xcode versions (10.3, 12.4 and 13). Then, probably not sure since, but XCTest framework changed the behavior. It seems launch and activate which are the endpoint of XCTest in WDA cannot launch the WDA process itself. e.g. https://developer.apple.com/documentation/xctest/xcuiapplication/2873317-activate

For instace, in the below line worked very slowly. Once they succeeded, launch and activate method by XCTest started to re-install WDA apps. The process was stopped. So, it seems ‘activate the app process’ seems broken or changed the behavior from Apple’s documentation. current master: https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Routing/FBSession.m#L202 A bit old one: https://github.com/appium/WebDriverAgent/blob/a1824895274c60798b506f31054e4ce1e0400c71/WebDriverAgentLib/Routing/FBSession.m#L213 I also tried WDA in 1.17.0.

Anothe thisng. When i called the below activateAppInfo command when I manually bring WDA app forward by tapping the app icon, it returned the spring board instead of the WDA bundle id.

> @driver.execute_script 'mobile:activeAppInfo'
=> {"processArguments"=>{"env"=>{}, "args"=>[]}, "name"=>"", "pid"=>49, "bundleId"=>"com.apple.springboard"}

I installed another WDA as different bundle id. Let assume this another one is WDA B. The former is WDA A. When I launched an appium session with the WDA A, the A was able to activate the WDA B. But WDA A was not able to activate the WDA A itself.

So, not sure since, but it seems XCTest framework itself behaved differently… For now, the blow steps are probably solid way.

  1. launch spring board: @driver.activate_app 'com.apple.springboard'
  2. Open WDA: @driver.find_element :accessibility_id, 'WebDriverAgentRunner-Runner' and click it

I’ll add this way in the documentation

1reaction
nikoskyrcommented, Jun 28, 2021

@KazuCocoa thanks a lot for the detailed description of the problem. It is now understandable how the “problem” introduced at first place.

So at the time being the only solution-workaround is to launch the springboard and then open the WDA. I think we can close this issue!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode is unable to correctly run W… | Apple Developer Forums
Xcode is unable to correctly run WebDriverAgent on iOS due to error: Too many instances of this service are already running.
Read more >
how to send some String value to ios real device clipboard ...
Activate App command cannot launch the WebDriverAgent properly on some environments. It depends on XCTest framework by Apple. Then, you should ...
Read more >
Troubleshooting - Appium
If you're running Appium.app. Update the app and restart. If you get a message saying the app can't be updated, re-download it from...
Read more >
appium-xcuitest-driver - npm
Executes the given app on the device under test. If the app is already running then it would be activated. If the app...
Read more >
Ios xctest mobile apps management - appium - Read the Docs
mobile: activateApp. Activates an existing application on the device under test and moves it to the foreground. The application should be already running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found