我正在尝试使用chrome驱动程序单击此登录按钮。 它不会返回错误,但没有单击按钮,每次运行代码时,我都会在网页左侧看到一个小符号,上面写着“javascript:void(0);”
这是我的密码。 提前谢谢
import os
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome(executable_path="/Users/XXX/Documents/chromedriver")
driver.get('https://www.hometax.go.kr/websquare/websquare.html?w2xPath=/ui/pp/index.xml')
driver.implicitly_wait(3)
driver.find_element_by_xpath(
'//*[@class="w2group "]'
).click()
请试一试
首先,通过
//*[@class="w2group "]
选择了错误的对象 此XPath表示选择了该页面的类属性为“w2group”的所有对象中的第一个此外,还包括“的id”로그인" 元素是:“textbox81212912”
其次,使用显式等待目标元素而不是隐式等待。这有助于防止意外错误,例如:由于网络速度等原因导致的页面加载错误
相关问题 更多 >
编程相关推荐