您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

奇怪的Python Selenium按钮单击行为

奇怪的Python Selenium按钮单击行为

试试这个xpath(用代码块更新,所以网站删除了我的*)

//*[contains(concat(' ', @class, ' '), ' btns right ')]//*[contains(concat(' ', @class, ' '), ' expand-all ') and contains(text(), 'View All Cards')]

提供一些等待元素可点击(建议隐式)。

我只用于java,但是我在这里引用了python 这可能有帮助!

from selenium.webdriver.support import expected_conditions as EC

wait = webdriverwait(driver, 10)
button = wait.until(EC.element_to_be_clickable((By.XPATH,'//*[contains(concat(' ', @class, ' '), ' btns right ')]//*[contains(concat(' ', @class, ' '), ' expand-all ') and contains(text(), 'View All Cards')]')))
button.click()


Even if the above thing fails, try this

形成这些链接link1和link2

driver.execute_script("document.getElementsByClassName('expand-all')[0].click();")

在所需元素上插入人工点击,删除(注释)所有其他代码

可能是您的应用属于link2 OP :)

python 2022/1/1 18:18:53 有436人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶