appium: Appium from 1.7.1 update to 1.8.1, find_element_by_id doesn't work

When i update to 1.8.1, the ‘find_element_by_id’ has an error. The code is self.driver.find_element_by_id("com.hlg.daydaytobusiness:id/rl_new_vip").click() error : image image

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 58 (23 by maintainers)

Most upvoted comments

In my case upgrading appium-python-client from 0.20 to 0.28 done the trick

pip install Appium-Python-Client --upgrade

First,the same code in 1.7.1 is good but in 1.8.1 is error. Second, ‘find_element_by_id’ doesn’t set up the webview context.

Fix for Java (1.8.0_172):

  • Downgrade appium to 1.8.1 - npm install -g appium@1.8.1

My guess is correct. Selenium API simply forcefully rewrites all selectors to CSS: https://github.com/SeleniumHQ/selenium/blob/2c2db8a47b72b1e9d1c380b4e8664de1b13ebada/py/selenium/webdriver/remote/webelement.py#L667

🤦‍♂️

I was able to resolve this issue by upgrading Appium-Python-Client , my current version was 0.26

This will work fir Robotframework as well pip install Appium-Python-Client --upgrade

So,

It Works !

Did you mean it worked updating Appium server from 1.9.1 to @beta? (Some API for Web Context, has not implemented W3C spec yet, can fix this.)

Or do you mean when driver.FindElement(By.Id(...)) style will be fixed as well as driver.FindElementById?

If you meant the later, we’ll probably guide using farmer way with the latest client for a while. (Wellcome to the fixing PR though 😃 )

Thanks. @hnkhuy Which appium java client version do you use? If you use before 6.0 ( https://github.com/appium/java-client/releases ), could you try the latest 6.1.0?

I found 3.4.0 number in your log. I guess your appium java client is old one since the latest Java client uses selenium 3.14.0.

\Users\huy.huynh\.m2\repository\org\seleniumhq\selenium\selenium-api\3.4.0\selenium-api-3.4.0.jar;C:\Users\huy.huynh\.m2\repository\org\testng\testng\6.9.4\testng-6.9.4.jar;C:\Users\huy.huynh\.m2\repository\org\beanshell\bsh\2.0b4\bsh-2.0b4.jar;C:\Users\huy.huynh\.m2\repository\com\beust\jcommander\1.48\jcommander-1.48.jar;C:\Users\huy.huynh\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\3.4.0\selenium-remote-driver-3.4.0.jar;