Unable to locate webview element on Android real device

Hello there,

I’m struggling to perform tests on Android Webview.
I’m using Appium server 1.17 (I keep this one locally because this is the one running on Browserstack too) and my tests are in python with pytest.
I’m able to click on webview element using an emulator but when I try to run it on a real device I have this message :
E selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome ‘119.0.6045’. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
E Stacktrace:
E UnknownError: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome ‘119.0.6045’. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
E at getResponseForW3CError (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
E at asyncHandler (/opt/homebrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:392:37)

First of all, the link provided in the stacktrace redirect to 404 :face_with_hand_over_mouth:
I tried running appium with --allow-insecure chromedriver_autodownload but it does not fix it.
I also tried many other little thing that I don’t remember like switching versions, trying to install it manually and so on.

Desperate, I tried to use the click on coordinate but as I first do a swipe and it does not always result to the same swipe without changing the coordinate or the percent (why btw ?? :joy: it works on Appium inspector and I double checked the coordinate on my emulator), so my test is flaky and I really want to do it the right way.

Anyone is able to unblock me with this driver issue ? Or to provide a better way to interact with webview on Android maybe ? Here is the method I use to click on an element :

def tap_on_android_webview_element(driver: WebDriver, element_id, default_wait_interval=10):
    # switch context to Weview
    driver.switch_to.context('WEBVIEW')
    wait(2)
    print('Tap on webview element with ID: ' + element_id)
    WebDriverWait(driver, default_wait_interval).until(EC.element_to_be_clickable((By.ID, element_id))).click()
    # switch context back to Native
    driver.switch_to.context('NATIVE_APP')
    wait(2)

Don’t know if it will help, but here is where that 404 link moved to:

https://appium.github.io/appium.io/docs/en/writing-running-appium/web/chromedriver/

Thanks for the link @wreed, I tried most of the solutions here.
I have CHROMEDRIVER_VERSION in my path:
CHROMEDRIVER_VERSION=119.0.6045.105, I run appium with or without --allow-insecure chromedriver_autodownload, I tried with a manual download, I even tried to update chromedriver.js in appium folder and add only my version which is not in the list by default.

For the manual start, I did that but not sure it was the right folder to store the driver :
appium --chromedriver-executable ‘/Users/my.user/Downloads/chrome-mac-arm64/Google Chrome for Testing.app’

It always result to a log like this one in appium :
[debug] [Chromedriver] Error: No Chromedriver found that can automate Chrome ‘119.0.6045’
and it always pick a 114.x version :
[debug] [Chromedriver] The following Chromedriver executables were found:
[debug] [Chromedriver] ‘/opt/homebrew/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v114.0.5735.90’ (version ‘114.0.5735.90’, minimum Chrome version ‘114’)
[debug] [Chromedriver] ‘/opt/homebrew/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v114.0.5735.16’ (version ‘114.0.5735.16’, minimum Chrome version ‘114’)

Can it be a limitation on chromedriver version due to my appium version ?

Yes, that could be the issue. Appium 1 hasn’t been supported since 01/22, if the driver is newer than that it’s incompatible.