Click() is not working with selenium 4.12.0 and appium-python-client 2.11.1

We automate tests on mobile , everything worked fine with -
selenium version -3.14
Appium python client - .48
appium desktop version - 1.22.3
python - 3.8.5

 **self.driver.find_element_by_id(AppiumBy.ID, locator).click()**

But after updating to selenium version to 4.X , the click method is not working.

selenium - 4.12.0
Appium python client - 2.11.1

a = self.driver.find_element(AppiumBy.ID, locator)

It works if I repeat this step “” twice like below:
a = self.driver.find_element(AppiumBy.ID, locator)

Please let me know what could be the possible issue and is there any alternate way to click on element.

Not sure what the issue is and why it doesn’t work, but there are alternatives to the click(). You can use TouchActions or the mobile: tap command to tap at certain co-ordinates. I found that Click() sometimes didn’t work for me so I created a method TapAtCentreOfElement() which gets the co-ordinates, works out the middle of the element, and then uses TouchAction to tap at those co-ordinates on screen. I’ve found it to be more reliable than Click(). My code is in C# so I’m not sure it will help you to post it here, but it should be very doable in Python.

1 Like