Python 3.x 无法在浏览器中单击radio元素(使用Python 3和Selenium)
我正在使用Python 3,并使用Selenium在浏览器中单击单选按钮。我能够找到要单击的无线电元素。但是,当我执行Python 3.x 无法在浏览器中单击radio元素(使用Python 3和Selenium),python-3.x,selenium,selenium-webdriver,selenium-chromedriver,Python 3.x,Selenium,Selenium Webdriver,Selenium Chromedriver,我正在使用Python 3,并使用Selenium在浏览器中单击单选按钮。我能够找到要单击的无线电元素。但是,当我执行元素。单击()时,它会给我一个错误: Message: unknown error: Element <Description of Element> is not clickable at point (340, 190). Other element would receive the click: <Description of some other e
元素。单击()
时,它会给我一个错误:
Message: unknown error: Element <Description of Element> is not clickable at point (340, 190).
Other element would receive the click: <Description of some other element>.
使用Actions类或Java脚本执行器来实现这一点
from selenium.webdriver.common.action_chains import ActionChains
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
ActionChains(browser).move_to_element(Registered_Project_RadioButton).click().perform()
或
谢谢昆都克。第一个选项不起作用,但第二个解决方案起作用。谢谢:)您需要关闭其他元素或等待它消失,例如加载。。。弹出窗口、浮动标题、对话框等。
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
Registered_Project_RadioButton.click()
from selenium.webdriver.common.action_chains import ActionChains
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
ActionChains(browser).move_to_element(Registered_Project_RadioButton).click().perform()
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
browser.execute_script("arguments[0].click();", Registered_Project_RadioButton)