appium / appium

Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
http://appium.io/
Apache License 2.0
18.95k stars 6.07k forks source link

Original error: No Chromedriver found that can automate Chrome '121.0.6167'. #20145

Closed GitAmi55 closed 5 months ago

GitAmi55 commented 5 months ago

Do I have the most recent component updates?

Is the component officially supported by the Appium team?

Is there an existing issue for this?

Current Behavior

Scenario: I am currently trying to use automate MS login integrated to native app. To enter password, it opens a webview, upon successfully entering password, it reverts back to the native app.

I am currently using robotframework, Appium, Python and currently facing issue when trying to add password in webview (before it was working fine, not sure whats causing issue now).

These are the keywords that I am using before, with appium library:

            Input Text                                 xpath=//android.widget.Button[@index="0"]    password
            Click Element                           xpath=//android.widget.Button[@text="enter"]

I tried to add - Switch To Context WEBVIEW_Terrace as I read thats more appropriate to use when handling webview in appium automation. So before performing entering password I try to switch WEBVIEW_Terrace , and lit giving me the error: WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '121.0.6167'. You could also try to enable automated chromedrivers download as a possible workaround.

How can we fix this?

Expected Behavior

User should be able to inspect webview in appium automation

Minimal Reproducible Example

appium -v2.5.4 appium-uiautomator2-driver@3.1.0

pip3 list Package Version


Appium-Python-Client 3.2.1 attrs 23.2.0 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 cryptography 42.0.5 cx_Oracle 8.3.0 decorator 5.1.1 docutils 0.21 grpcio 1.62.1 grpcio-tools 1.62.1 h11 0.14.0 idna 3.7 kitchen 1.2.6 numpy 1.26.4 opencv-python 4.9.0.80 openvino 2024.0.0 oracledb 2.1.2 outcome 1.3.0.post0 overrides 7.7.0 packaging 24.0 pillow 10.2.0 pip 24.0 protobuf 4.25.3 pycparser 2.22 PySocks 1.7.1 pytesseract 0.3.10 pytz 2024.1 requests 2.31.0 robotframework 7.0 robotframework-appiumlibrary 2.0.0 robotframework-archivelibrary 0.4.2 robotframework-assertion-engine 3.0.3 robotframework-browser 18.3.0 robotframework-oracledb 2.0.2 robotframework-pythonlibcore 4.4.1 robotframework-requests 0.9.7 robotframework-seleniumlibrary 6.2.0 selenium 4.14.0

Environment

eglitise commented 5 months ago

Please refer to the UiAutomator2 documentation for Chromedriver discovery. The simplest approach would be to launch the Appium server as appium --allow-insecure chromedriver_autodownload.

GitAmi55 commented 5 months ago

Right, I've read the article and I do launch with : appium server -p 4725 -pa /wd/hub --allow-insecure chromedriver_autodownload but still see the error An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '121.0.6167'.

KazuCocoa commented 5 months ago

Could you share the full appium log as well?

KazuCocoa commented 5 months ago

Could you give us full log to see given arguments etc as well to track entire lines?

mykola-mokhnach commented 5 months ago

Could you please verify below requests return proper responses on the server host?

curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
curl -H 'Accept: application/xml' https://chromedriver.storage.googleapis.com 
GitAmi55 commented 5 months ago

curl -H 'Accept: application/xml' https://chromedriver.storage.googleapis.com

`yes, Both ran successfully without any errors.

GitAmi55 commented 5 months ago

Could you give us full log to see given arguments etc as well to track entire lines?

Input Text xpath=//android.widget.EditText[@text='email'] emailtext. -> Enter email in Native app Click Element xpath=//android.widget.Button[@text="next"] -> enter next page bi.Sleep 10s ${contexts} = al.Get Contexts bi.Log ||--${contexts} are the contexts--||
Switch To Context WEBVIEW_Terrace

KazuCocoa commented 5 months ago

Thanks, but the full log meant appium server log from the beginning, rather than client side code. The log might be large, then please use github gist.

Btw, below log indicates the request to URLs in the previous mykola's comment might return 400 from your server env at that time. usually it should be 200 ok and json response for autodoanload.

[Chromedriver@0d0f] Cannot synchronize local chromedrivers with the remote storage: Request failed with status code 400
[Chromedriver@0d0f] AxiosError: Request failed with status code 400
[Chromedriver@0d0f]     at settle (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/axios/lib/core/settle.js:19:12)
[Chromedriver@0d0f]     at IncomingMessage.handleStreamEnd (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/axios/lib/adapters/http.js:589:11)
[Chromedriver@0d0f]     at IncomingMessage.emit (node:events:531:35)
[Chromedriver@0d0f]     at endReadableNT (node:internal/streams/readable:1696:12)
[Chromedriver@0d0f]     at processTicksAndRejections (node:internal/process/task_queues:82:21)
[Chromedriver@0d0f]     at Axios.request (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/axios/lib/core/Axios.js:45:41)
[Chromedriver@0d0f]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[Chromedriver@0d0f]     at retrieveData (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/utils.js:92:5)
[Chromedriver@0d0f] Error: No Chromedriver found that can automate Chrome '121.0.6167'.
[Chromedriver@0d0f]     at Chromedriver.getCompatibleChromedriver (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:468:15)
[Chromedriver@0d0f]     at Chromedriver.initChromedriverPath (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:500:11)
[Chromedriver@0d0f]     at Chromedriver.start (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:620:32)
[Chromedriver@0d0f]     at AndroidUiautomator2Driver.setupNewChromedriver (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context/helpers.js:745:3)
[Chromedriver@0d0f]     at AndroidUiautomator2Driver.startChromedriverProxy (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context/exports.js:229:10)
[Chromedriver@0d0f]     at AndroidUiautomator2Driver.switchContext (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context/exports.js:108:5)
[Chromedriver@0d0f]     at AndroidUiautomator2Driver.setContext (/Users/shettya/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context/exports.js:64:3)
[Chromedriver@0d0f] No Chromedriver found that can automate Chrome '121.0.6167'.
GitAmi55 commented 5 months ago

and regarding request to URLs from mykola's comment: I ran those script on my terminal and returned a json response. Was there something else I needed to do? - sorry again.

KazuCocoa commented 5 months ago

Thanks. Actually autodwonload was enabled. The log indicates the environment got 400 response. Hm, what I could assume right now is the mykola's attached urls returned 400 in your script run. i haven't seen 400 case, but it occurred on your local... so appium was not able to download proper chromedriver from the internet. https://github.com/appium/appium-chromedriver/blob/f09915cef815096492a197865f55faa964d3fa5a/lib/chromedriver.js#L354-L378

As a workaround, you could download a chromedriver for chrome 121 from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json 's zip download url. Then you could set the url for appium:chromedriverExecutable capability.

GitAmi55 commented 5 months ago

Thank you! As per your suggesstion -

The chromedriver has correct path (as per screenshot) and the file has user level read and write access. However, I still get the error when I run the scripts: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to use a chromedriver binary at the path '/Users/shettya/Downloads/Appium/chromedriver', but it doesn't exist! ! Get info - chromedriver

mykola-mokhnach commented 5 months ago

[AndroidUiautomator2Driver@b2f2] "appium:chromedriverExecutable": "'/Users/shettya/Downloads/Appium/chromedriver'",

the value probably contains extra quotes

GitAmi55 commented 5 months ago

Thanks for pointing it out :) However, I see ``` Original error: unknown error: Failed to get sockets matching: @weblayer_devtoolsremote.*16306 (make sure the app has its WebView/WebLayer configured for debugging)



Things I checked:  Under settings> apps > Made sure Android System WebView is enabled. 
Added appium capabilities: setWebContentsDebuggingEnabled=${True}

Is there something else I need to do to fix this error?
mykola-mokhnach commented 5 months ago

Added appium capabilities: setWebContentsDebuggingEnabled=${True}

This won't work. The web view must be made debugabble in the app source code

GitAmi55 commented 5 months ago

okay just checked, they're debuggable. However, they're using customTabs for it apparently. How do we proceed with it?

GitAmi55 commented 5 months ago

['NATIVE_APP', 'WEBVIEW_Terrace'] are the available contexts. Since its debuggable only in Customtabs. I removed switchcontext keyword.

Instead,

mykola-mokhnach commented 5 months ago

Please use Appium forum to ask questions. Closing this thread as not issue.

GitAmi55 commented 5 months ago

I havent been able to get any help to my previous posts. But if you know, Could you atleast let me know if switchContext is required in such cases please?

mykola-mokhnach commented 5 months ago

I'm sorry about your previous experience, but this is how open source works. It is usually easier for people to answer questions that have all the necessary details and the background info provided.

Eventually it would probably be the best to simply hire a consultant to solve an issue fast.

KazuCocoa commented 5 months ago

https://github.com/appium/appium/issues/16031 could be the case

GitAmi55 commented 5 months ago

Thank you @KazuCocoa @mykola-mokhnach for all the help and time :)