Can't start application that opens Chrome if Chrome shows Welcome page

I have a native application that performs a check of new version at the start. In order to do this check it opens a specific URI in Chrome and redirects back to the application when the new version check is performed.

The problem appears when Chrome is opened for the first time and “Welcome to Chrome” page is displayed. In this case welcome page is still open in Chrome (awaiting for user reaction) and the redirect to the application doesn’t happen. As the result Appium fails to start the application, because it starts an activity with “-W” flag that means that is should wait for activity to complete, but it doesn’t happen:

[ADB] Running '<sdk_path>\platform-tools\adb.exe' with args: ["-P",5037,"-s","emulator-5554","shell","am","start","-W","-n","<activity_name>","-S"]
[ADB] Error: Error occured while starting App. Original error: Error executing adbExec. Original error: 'Command '<sdk_path>\\platform-tools\\adb.exe -P 5037 -s emulator-5554 shell am start -W -n <activity_name> -S' timed out after 20000ms'; Stderr: ''; Code: 'null'

I didn’t find any similar problems, I see several ideas how this problem could be avoided:

  1. somehow instruct Appium that a launch activity should be started without “-W” key
  2. run Chrome before and close this Welcome page - I haven’t found working example with adb to start Chrome with “–no-first-run” option, there could be problems with running this workaround on the devices in cloud;
  3. change the application logic - unfortunatelyI have no control over it.

I guess that variant 1) is the correct one. Does anybody know if it’s possible to avoid waiting for launch activity to be completed when the application starts?

Other ideas are also welcome :slight_smile:

Appium console logs can be provided additionally.