AttributeError: 'dict' object has no attribute 'click'
Hello,
While running the python example available here, the following error popup:
C:\Users\anas9\PycharmProjects\winappdrivertest\venv\Scripts\python.exe C:/Users/anas9/PycharmProjects/winappdrivertest/main.py
test_addition (__main__.SimpleCalculatorTests) ... C:\Users\anas9\PycharmProjects\winappdrivertest\main.py:51: DeprecationWarning: find_element_by_name is deprecated. Please use find_element(by=By.NAME, value=name) instead
self.driver.find_element_by_name("One").click()
ERROR
test_combination (__main__.SimpleCalculatorTests) ... C:\Users\anas9\PycharmProjects\winappdrivertest\main.py:58: DeprecationWarning: find_element_by_name is deprecated. Please use find_element(by=By.NAME, value=name) instead
self.driver.find_element_by_name("Seven").click()
ERROR
test_division (__main__.SimpleCalculatorTests) ... C:\Users\anas9\PycharmProjects\winappdrivertest\main.py:70: DeprecationWarning: find_element_by_name is deprecated. Please use find_element(by=By.NAME, value=name) instead
self.driver.find_element_by_name("Eight").click()
ERROR
test_initialize (__main__.SimpleCalculatorTests) ... C:\Users\anas9\PycharmProjects\winappdrivertest\main.py:45: DeprecationWarning: find_element_by_name is deprecated. Please use find_element(by=By.NAME, value=name) instead
self.driver.find_element_by_name("Clear").click()
ERROR
test_multiplication (__main__.SimpleCalculatorTests) ... C:\Users\anas9\PycharmProjects\winappdrivertest\main.py:79: DeprecationWarning: find_element_by_name is deprecated. Please use find_element(by=By.NAME, value=name) instead
self.driver.find_element_by_name("Nine").click()
ERROR
test_subtraction (__main__.SimpleCalculatorTests) ... C:\Users\anas9\PycharmProjects\winappdrivertest\main.py:86: DeprecationWarning: find_element_by_name is deprecated. Please use find_element(by=By.NAME, value=name) instead
self.driver.find_element_by_name("Nine").click()
ERROR
======================================================================
ERROR: test_addition (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\anas9\PycharmProjects\winappdrivertest\main.py", line 51, in test_addition
self.driver.find_element_by_name("One").click()
AttributeError: 'dict' object has no attribute 'click'
======================================================================
ERROR: test_combination (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\anas9\PycharmProjects\winappdrivertest\main.py", line 58, in test_combination
self.driver.find_element_by_name("Seven").click()
AttributeError: 'dict' object has no attribute 'click'
======================================================================
ERROR: test_division (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\anas9\PycharmProjects\winappdrivertest\main.py", line 70, in test_division
self.driver.find_element_by_name("Eight").click()
AttributeError: 'dict' object has no attribute 'click'
======================================================================
ERROR: test_initialize (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\anas9\PycharmProjects\winappdrivertest\main.py", line 45, in test_initialize
self.driver.find_element_by_name("Clear").click()
AttributeError: 'dict' object has no attribute 'click'
======================================================================
ERROR: test_multiplication (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\anas9\PycharmProjects\winappdrivertest\main.py", line 79, in test_multiplication
self.driver.find_element_by_name("Nine").click()
AttributeError: 'dict' object has no attribute 'click'
======================================================================
ERROR: test_subtraction (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\anas9\PycharmProjects\winappdrivertest\main.py", line 86, in test_subtraction
self.driver.find_element_by_name("Nine").click()
AttributeError: 'dict' object has no attribute 'click'
----------------------------------------------------------------------
Ran 6 tests in 1.314s
FAILED (errors=6)
Process finished with exit code 0
Did you update the selenium package to version4? Then all the API's in the sample code will not work you need to use Appium.By
Did you update the selenium package to version4? Then all the API's in the sample code will not work you need to use Appium.By
Thanks, could you please help me with an example or link.
Just change all the API of find_element to Appium.By
Check https://github.com/anunay1/SampleWADPython/tree/master
Thank you 👍
winappdriver didnt work with w3c
I have the same error when using Selenium4, but Selenium3 works fine for me. BTW, I am using Selenium 3.14.0 for WinAppDriver.
I have exactly same issue. Can not downgrade to Selenium 3.x anymore because i am using appium-python-client 2.2.0 (requiring Selenium 4.x).
I've tried to use Appium.By but it does not help. With the same test calculator code (SimpleCalculatorTests) getting the error:
self.driver.find_element(AppiumBy.NAME, "Clear").click()
AttributeError: 'dict' object has no attribite 'click'
Using selenium 4.7.2 now but tested multiple 4.x versions with the same result.
Any hints how to solve this problem ?