Issue
This Content is from Stack Overflow. Question asked by Amal 220003
my code
driver.find_element(By.cssSelector(“button[type=’submit’]”)).click()
driver.quit()
after running
error
C:UsersamalpOneDriveDesktoppico.py:7: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver=webdriver.Chrome(path)
Traceback (most recent call last):
File “C:UsersamalpOneDriveDesktoppico.py”, line 11, in
driver.find_element(By.cssSelector(“button[type=’submit’]”)).click()
AttributeError: type object ‘By’ has no attribute ‘cssSelector’
Solution
Instead of
driver.find_element(By.cssSelector("button[type='submit']")).click()
Try
driver.find_element(By.cssSelector,"button[type='submit']").click()
This Question was asked in StackOverflow by Amal 220003 and Answered by Prophet It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.