Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on default activity that starts chrome browser on android 13 #17492

Closed
Hubert-Rudzik opened this issue Sep 15, 2022 · 16 comments
Closed

Error on default activity that starts chrome browser on android 13 #17492

Hubert-Rudzik opened this issue Sep 15, 2022 · 16 comments
Labels
Mobile Chrome related to mobile Chrome driver ThirdParty upstream problems

Comments

@Hubert-Rudzik
Copy link

Hubert-Rudzik commented Sep 15, 2022

[update]
#17492 (comment) is a workaround in Appium

The problem

When starting chrome browser on android 13 I get Activity class {com.android.chrome/com.google.android.apps.chrome.Main} does not exist. It comes with the fact that chrome browser is started diiferently on newest android version (full description here (https://automationchronicles.com/error-when-opening-chrome-on-android-13-via-adb/). My solution is changing activity to
com.google.android.apps.chrome.IntentDispatcher with added -d flag and default url or changing action to android.intent.action.MAIN.

Environment

  • Appium version: 1.22.3
  • Desktop OS/version used to run Appium: Macos 12.5.1
  • Mobile platform/version under test: Android 13

Link to Appium logs

https://gist.github.com/Hubert-Rudzik/3daaac080a6b6b42347569f0dde4afcd

@mykola-mokhnach
Copy link
Collaborator

The error is coming from chromedriver itself. Please consider reporting it to Google. UIA2 driver acts as a simple proxy there

@mykola-mokhnach mykola-mokhnach added Mobile Chrome related to mobile Chrome driver ThirdParty upstream problems labels Sep 15, 2022
@mykola-mokhnach
Copy link
Collaborator

Closed as third party issue

@sri096
Copy link

sri096 commented Oct 20, 2022

Hey,

Thanks for looking into this issue # #17632 and marking as duplicate to this.

Could you please confirm if you meant the log excerpt below is from Chromedriver or appium-chromedriver?

2022-09-14 11:58:06:729 - [debug] [Chromedriver] UnknownError: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to start com.android.chrome on device 1C141FDF60094F: Starting: Intent { dat=data: cmp=com.android.chrome/com.google.android.apps.chrome.Main }
2022-09-14 11:58:06:729 - [debug] [Chromedriver] Error type 3
2022-09-14 11:58:06:730 - [debug] [Chromedriver] Error: Activity class {com.android.chrome/com.google.android.apps.chrome.Main} does not exist.
2022-09-14 11:58:06:730 - [debug] [Chromedriver] 
2022-09-14 11:58:06:730 - [debug] [Chromedriver]     at errorFromW3CJsonCode (/opt/testdroid/appium-1.22.3/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:780:25)
2022-09-14 11:58:06:730 - [debug] [Chromedriver]     at ProxyRequestError.getActualError (/opt/testdroid/appium-1.22.3/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:663:14)
2022-09-14 11:58:06:730 - [debug] [Chromedriver]     at JWProxy.command (/opt/testdroid/appium-1.22.3/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:272:19)
2022-09-14 11:58:06:730 - [debug] [Chromedriver]     at runMicrotasks (<anonymous>)
2022-09-14 11:58:06:730 - [debug] [Chromedriver]     at processTicksAndRejections (internal/process/task_queues.js:93:5)
2022-09-14 11:58:06:731 - [Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM

Also can you please point the line of code in UIA2 driver where a call is made to Chromedriver?

Thanks,
-K

@KazuCocoa
Copy link
Member

The below log means appium sendt the capabilities to the local chromedriver like https://chromedriver.chromium.org/getting-started/getting-started---android#h.p_ID_390 does. Then, appium got the response. So the Failed to start... message itself came from the chromedriver.

2022-09-14 11:58:06:341 - [Chromedriver] Starting W3C Chromedriver session with capabilities: {
2022-09-14 11:58:06:341 - [Chromedriver]   "capabilities": {
2022-09-14 11:58:06:342 - [Chromedriver]     "alwaysMatch": {
2022-09-14 11:58:06:342 - [Chromedriver]       "goog:chromeOptions": {
2022-09-14 11:58:06:342 - [Chromedriver]         "androidPackage": "com.android.chrome",
2022-09-14 11:58:06:342 - [Chromedriver]         "androidDeviceSerial": "1C141FDF60094F"
2022-09-14 11:58:06:342 - [Chromedriver]       },
2022-09-14 11:58:06:343 - [Chromedriver]       "goog:loggingPrefs": {
2022-09-14 11:58:06:343 - [Chromedriver]         "browser": "ALL"
2022-09-14 11:58:06:343 - [Chromedriver]       }
2022-09-14 11:58:06:343 - [Chromedriver]     }
2022-09-14 11:58:06:343 - [Chromedriver]   }
2022-09-14 11:58:06:344 - [Chromedriver] }
2022-09-14 11:58:06:344 - [debug] [WD Proxy] Matched '/session' to command name 'createSession'
2022-09-14 11:58:06:344 - [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"1C141FDF60094F"},"goog:loggingPrefs":{"browser":"ALL"}}}}
2022-09-14 11:58:06:687 - [WD Proxy] Got response with status 500: {"value":{"error":"unknown error","message":"unknown error: Failed to start com.android.chrome on device 1C141FDF60094F: Starting: Intent { dat=data: cmp=com.android.chrome/com.google.android.apps.chrome.Main }\nError type 3\nError: Activity class {com.android.chrome/com.google.android.apps.chrome.Main} does not exist.\n","stacktrace":"#0 0x5573dc33ccd3 <unknown>\n#1 0x5573dc144968 <unknown>\n#2 0x5573dc1204dc <unknown>\n#3 0x5573dc12bc72 <unknown>\n#4 0x5573dc16527a <unknown>\n#5 0x5573dc19f94a <unknown>\n#6 0x5573dc199aa3 <unknown>\n#7 0x5573dc16f3fa <unknown>\n#8 0x5573dc170555 <unknown>\n#9 0x5573dc3842bd <unknown>\n#10 0x5573dc388418 <unknown>\n#11 0x5573dc36e36e <unknown>\n#12 0x5573dc389078 <unknown>\n#13 0x5573dc362bb0 <unknown>\n#14 0x5573dc3a5d58 <unknown>\n#15 0x5573dc3a5ed8 <unknown>\n#16 0x5573dc3bfcfd <unknown>\n#17 0x7f213f2196db <unknown>\n"}}
2022-09-14 11:58:06:688 - [debug] [W3C] Matched W3C error code 'unknown error' to UnknownError

The request to the chrome itself occurs in https://github.com/appium/appium-chromedriver/blob/ca97ac7c4c230d52d001bf4d854ab54ac371d908/lib/chromedriver.js#L597

@sri096
Copy link

sri096 commented Oct 20, 2022

Hello,

Thanks for the quick reply, appreciate it!

I have verified with Chrome Driver without Appium Proxy and seeing the same issue.

Thanks,
-K

@boneskull boneskull unpinned this issue Oct 27, 2022
@mikhailnersesov
Copy link

Facing the same issue..

Do I understand it correctly, that due to the fact, that this is third party issue (chromedriver itself) - there is no solution for it and we can not start Chrome Browser on the Android 13 currently?

@KazuCocoa
Copy link
Member

KazuCocoa commented Nov 15, 2022

As a workaround in Appium. you can start a chrome browser session with appPackage as com.android.chrome and appActivity as com.google.android.apps.chrome.Main, open a url via dirver.get 'url', and switch the context to WEBVIEW_chorme. It could avoid the new session request's issue in the chromedriver.

You also can do some interactions in the NATIVE_APP context.

@jaylazda
Copy link

Hi @KazuCocoa, I'm also facing the same issue and I tried implementing your workaround but I get this error, and chrome is installed on the phone:

Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.android.chrome' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Cannot start the 'com.android.chrome' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name '.com.google.android.apps.chrome.Main' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

@mikhailnersesov
Copy link

Hey @KazuCocoa thanks a lot! Worked perfectly for me!
@jaylazda maybe my implementation will help you:

BaseMobilePage:
if/Android 13 workaround because of:/(platformVersion.equals("13")){
desiredCapabilities.setCapability("appPackage", "com.android.chrome");
desiredCapabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main");
}else{
desiredCapabilities.setBrowserName(MobileBrowserType.CHROME);
}

Test:
if/Android 13 workaround because of Chrome bug:/ (platformVersion.equals("13")) {
waitAndFind(chromeNotificationA13Button);
click(chromeNotificationA13Button);
}

// And now go to homepage
driver.navigate().to(startPage);

if/Android 13 workaround because of Chrome bug:/ (platformVersion.equals("13")) {
MobileDriver mobileDriver = (MobileDriver) driver;
mobileDriver.context("WEBVIEW_chrome");
}

@mikhailnersesov
Copy link

@jaylazda
can it be that you have a typo here?
Original error: Activity name '.com.google.android.apps.chrome.Main'

point at the start of the Activity name?

I have given it as "com.google.android.apps.chrome.Main" without any point at the start

@jaylazda
Copy link

@mikhailnersesov thanks but here are my capabilities, not sure why the . appears in the error message...
capabilities: [{
platformName: process.env.DEVICEFARM_DEVICE_PLATFORM_NAME,
platformVersion: process.env.DEVICEFARM_DEVICE_OS_VERSION,
deviceName: process.env.DEVICEFARM_DEVICE_NAME,
appPackage: "com.android.chrome",
appActivity: "com.google.android.apps.chrome.Main",
autoWebview: true,
automationName: "UiAutomator2",
autoGrantPermissions: true,
autoAcceptAlerts: true,
}]

@mikhailnersesov
Copy link

@jaylazda try to compare if you have exactly those package and activity on your phone: https://www.automationtestinghub.com/apppackage-and-appactivity-name/
maybe you have an app, but it has somehow other apks?(

@mikhailnersesov
Copy link

@jaylazda it does not look like a capabiliites problem, while with your set of capabilities - i did not receive this error by my project..
Google Pixel 4, Android 13

@jaylazda
Copy link

Thanks for checking. I just checked with APK info and chrome has the same appActivity and package as in my capabilities.

@KazuCocoa
Copy link
Member

Potentially another workaround might be needed in your environment to start a chrome browser process... Could the chrome browser version be related?

@KazuCocoa
Copy link
Member

According to https://bugs.chromium.org/p/chromedriver/issues/detail?id=4193&sort=status%20-id&q=com.android.chrome&can=2, Chrome 110 will have a fix for this issue.
Maybe we no longer need this workaround after the version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile Chrome related to mobile Chrome driver ThirdParty upstream problems
Projects
None yet
Development

No branches or pull requests

6 participants