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.

Restart app doesn't respect processArguments

See original GitHub issue

The problem

We passed processArguments to iOS app and we implemented mock feature there. Process arguments are passed as follows.

config.capabilities = [
{
  deviceName: 'iPhone 13',
  platformVersion: '15.4',
  automationName: 'XCUITest',
  ...
  processArguments: { 'args': ['--mock-fes-api', '--mock-attester-api'] },
},

Passing process arguments work well. But when I try to restart app with below code restarted session doesn’t respect processArguments and treat like normal app. I also tried with closeApp and activeApp functions though.

await driver.terminateApp(CommonData.bundleId.id);
await driver.activateApp(CommonData.bundleId.id);

Environment

  • Appium version (or git revision) that exhibits the issue: 1.22.3
  • Last Appium version that did not exhibit the issue (if applicable): 1.22.3
  • Desktop OS/version used to run Appium: Monterey 12.3.1
  • Node.js version (unless using Appium.app|exe): 14.17.6
  • Npm or Yarn package manager: 6.14.15
  • Mobile platform/version under test: iOS 15.4
  • Real device or emulator/simulator: Simulator
  • Appium CLI or Appium.app|exe: CLI

Link to Appium logs

https://gist.github.com/ioanmo226/14ba87c198383fa66ca2d833db3d417a

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
KazuCocoacommented, Apr 25, 2022

activateApp is not designed to set arguments except for bundleId/appPackage (in android).

https://github.com/appium/appium-xcuitest-driver#mobile-launchapp is to give environment arguments in the middle of a session in starting an app process for iOS.

1reaction
mykola-mokhnachcommented, Apr 25, 2022

The main purpose of activateApp call is to bring an app from the background to the foreground. It does not really care about arguments.

Use a combination of terminateApp/launchApp (with appropriate options) as @KazuCocoa mentioned above to achieve your goal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webdriverio iOS restart app with processArguments
We need to pass arguments in drvier.execute function. Here's the solution. const restartApp = async () => { await driver.
Read more >
Win32 app installation failure (can't use Stop-Process) : r/Intune
Hi all, I have a simple .exe app to install for which I'm using Microsoft ... 32 bit Powershell on 64 bit OS,...
Read more >
appium-xcuitest-driver - npm
Process arguments and environment which will be sent to the WebDriverAgent server in a new session request. Please use mobile:launchApp to launch an...
Read more >
Replacing a Process referenced in an App
Once the process is replaced, the action cannot be undone. Replacing a process where an argument is removed, may lead to invalid bindings...
Read more >
Appium 1.5.2 released
Confirm the change and restart the appium. It fixes the App installation and crash for simulators. Ryan May 4, 2016, 9:19pm #8. It...
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