单击div下的元素 [英] Click on element under div

查看:62
本文介绍了单击div下的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图单击隐藏的弹出框下方的单选按钮.

I'm trying to click on a radio button located under an hidden pop-up box.

问题是,硒不断单击隐藏的弹出框而不是单选按钮,并引发错误.

The problem is, selenium keeps clicking on the hidden pop-up box instead of the radio button and throws an error.

如何使它单击单选按钮而不是隐藏的弹出窗口?

How to make it click on the radio button instead of the hidden pop-up ?

弹出

<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>

推荐答案

element.SendKeys(Keys.Escape);

将关闭弹出窗口,然后单击即可.

will close the popup, then you can click.

这篇关于单击div下的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆