简体   繁体   English

Selenium 无法点击按钮

[英]Unable to click button with Selenium

I am having trouble clicking the login button with Selenium.我在使用 Selenium 单击登录按钮时遇到问题。 Here's my code:这是我的代码:

from selenium import webdriver
driver = webdriver.Chrome("/usr/local/bin/chromedriver")


driver.get('https://myfit4less.gymmanager.com/portal/login.asp')
driver.find_element_by_id("loginButton").click()

What you had was an overlaying element you could just target the element to click instead.您拥有的是一个覆盖元素,您可以将其定位为要单击的元素。

elem=driver.find_element_by_id("loginButton")
driver.execute_script("arguments[0].click();", elem)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM