无法单击按钮Selenium Python

时间:2019-03-10 15:24:55

标签: python selenium selenium-webdriver

无法在此页面上单击带有Selenium Python的按钮 link

我的代码

from selenium import webdriver
import bs4
import time
import sys

URL = "https://yandex.ru/sprav/search/chain/108880815285"
driver = webdriver.Firefox()
driver.get(URL)
time.sleep(3)

driver.find_element_by_id("passp-fieldlogin").send_keys("myMail@yandex.ru") # OK
# ERROR
driver.find_element_by_css_selector("What should I inputhere???").click() # ERROR

time.sleep(3)
driver.find_element_by_id("passp-fieldpasswd").send_keys("myPass")

enter image description here

图片

2 个答案:

答案 0 :(得分:1)

尝试其中任何一个。

driver.find_element_by_css_selector(".button2_view_classic").click()

OR

driver.find_element_by_css_selector("button.button2_view_classic").click()

答案 1 :(得分:0)

使用属性选择器

driver.find_element_by_css_selector("[type=submit]").click()

或快速类选择器

driver.find_element_by_css_selector(".button2_type_submit").click()

此按钮通过type属性及其值submit

定位按钮

enter image description here