我正在尝试点击位于隐藏弹出框下方的单选按钮。
问题是,selenium一直点击隐藏的弹出框而不是单选按钮并抛出错误。
如何点击单选按钮而不是隐藏弹出窗口?
弹出
<div style="z-index: 1008; opacity: 0.75; display: none;" id="a-popover-lgtbox"
class="a-declarative" data-action="a-popover-floating-close"></div>
单选按钮
<input name="Rights-radio" value="PUBLIC_DOMAIN" type="radio"></input>
的Python
rights_btn = browser.find_element_by_xpath("//input[@value='PUBLIC_DOMAIN']")
ActionChains(browser).move_to_element(rights_btn).click(rights_btn).perform()
错误
WebDriverException: Message: Element is not clickable at point (237.0833282470703, 346.5).
Other element would receive the click: <div style="z-index: 1008; opacity: 0; display: block;
transition: all 250ms linear 0s;" id="a-popover-lgtbox" class="a-declarative"
data-action="a-popover-floating-close"></div>
答案 0 :(得分:1)
element.SendKeys(Keys.Escape);
将关闭弹出窗口,然后您可以单击。