- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在网站上选择付款方式。我有三个选择:SEPA、信用卡/借记卡、PayPal。我想点击贷方/借方。
这些选择在一个主 div 中,每个选择都在另一个包含输入( radio 类型)和标签的 div 中。
问题是我无法点击这个选项,因为我有以下错误:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (466, 1613)
使用此代码:
element = driver.find_element_by_css_selector("input[type='radio'][id='input-method-cc'][value='cc']")
element.click()
我找到了一个可行的解决方法,但由于某些原因,它弄乱了表单并使其无效。这是我尝试过的:
element = driver.find_element_by_css_selector("input[type='radio'][id='input-method-cc'][value='cc']")
driver.execute_script("arguments[0].click();", element)
我尝试了其他解决方案,例如等待元素可见、xpath 等,但没有任何结果。我想知道为什么我的元素不可点击,而我可以用javascript点击它?
感谢任何帮助!谢谢
HTML 代码:
<div id="place-order" class="has-shadow">
<div class="white-box">
<div class="recurly-payment-fields mb-4">
<div class="recurly-payment-buttons row my-4">
<div class="recurly-payment-buttons__item col method-sepa" data-target="method-sepa">
<input type="radio" id="input-method-sepa" name="method" value="sepa" checked="" class="sr-only">
<label class="sr-only" for="method-sepa">SEPA</label>
<div class="recurly-payment-buttons__button p-3 d-flex justify-content-center">
<div class="logo"></div>
</div>
</div>
<div class="recurly-payment-buttons__item col method-cc active" data-target="method-cc">
<input type="radio" id="input-method-cc" name="method" value="cc" class="sr-only">
<label class="sr-only" for="method-cc">Credit Card</label>
<div class="recurly-payment-buttons__button p-3 d-flex justify-content-center">
<div class="logo"></div>
</div>
</div>
<div class="recurly-payment-buttons__item col method-paypal" data-target="method-paypal">
<input type="radio" id="input-method-paypal" name="method" value="paypal" class="sr-only">
<label class="sr-only" for="method-paypal">PayPal</label>
<div class="recurly-payment-buttons__button p-3 d-flex justify-content-center">
<div class="logo"></div>
</div>
</div>
</div>
<div id="recurly-payment-methods" class="recurly-payment-methods">
<div id="field-method-sepa" class="recurly-payment-methods__field method-sepa collapse" style="">
<p>
<label for="iban">IBAN</label>
<input type="text" id="iban" name="iban" class="form-control" placeholder="e.g. FR1420041010050500013M02606" data-recurly="iban">
</p>
</div>
<div id="field-method-cc" class="recurly-payment-methods__field method-cc collapsed collapse show" style="">
<div id="recurly-card-field" name="card">
<div data-recurly-element-id="HYOmiZxK5SgiQBEk" class="recurly-element recurly-element-card">
<iframe allowtransparency="true" frameborder="0" scrolling="no" name="recurly-element--HYOmiZxK5SgiQBEk" allowpaymentrequest="true" style="background: none; width: 100%; height: 100%;" src="https://api.recurly.com/..." tabindex="0"></iframe>
</div>
</div>
</div>
<div id="field-method-paypal" class="recurly-payment-methods__field method-paypal collapsed collapse" style="">
<span class="text-md-3">You will be directed to PayPal when checkout is complete.</span>
</div>
</div>
</div>
<div class="woocommerce-terms-and-conditions-wrapper">
<div class="terms-and-conditions-text mr-4">
<a data-toggle="collapse" href="#terms-and-conditions" class="terms-and-conditions-link" target="">
Clicking
<strong>Submit</strong>
means that you agree to the
<span class="text-link">terms and conditions</span>
.
</a>
</div>
<div id="terms-and-conditions" class="terms-and-conditions collapse rounded">
</div>
</div>
</div>
</div>
最佳答案
添加等待条件
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
element = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, "input[type='radio'][id='input-method-cc'][value='cc']")))
element.click();
关于python - Selenium (Python): Element is not clickable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67055917/
我有这个应用程序,在注册屏幕上的复选框旁边应该是一个句子:我同意公司服务条款。 服务条款部分应该是可点击的,以便用户能够进入 ToS 屏幕(尽管用户永远不会这样做)。 问题是,这个应用程序将是多语言的
我创建了一个这样的 if 语句: if (lehrling == null) { ClientScript.RegisterStartupScript(this.GetType(), "ale
我正在创建一个站点,您可以在其中单击一个按钮,然后会显示一个小面板。 (就像 facebook 上的通知/消息面板) 该功能运行良好,但当面板隐藏时,您仍然可以将链接悬停在它们应该位于的位置,当它们可
我想让“搜索”按钮在点击回车后可点击。 这是我的 html: 这是我正在使用的 JavaScript: function searchKeyPress(e) { if (typeof e ==
我有一个WP7应用,我想在其中有一个“可单击的” TextBlock区域,当用户单击TextBlock时,它将置于编辑模式(另一个控件)。 这将在编辑文本之前为用户添加另一个明确的步骤。 TextBl
我创建了一个名为 ClickableRow 的类,它突出显示该行并更改其中所有 TextViews 的文本颜色,然后将该行返回到其初始设置当用户停止点击或滚动太远之后,但我觉得 android 可能已
在开发 Android 应用程序时,我有一个带有一些按钮的 Activity 。我希望 onClickListener 操作在用户立即将手指放在屏幕上时启动,这样他就不能同时单击两个按钮。 我在 iO
http://speedsociety.com/ 如果您查看我的网站,左侧边栏下方的 instagram 小部件都不可点击(在第一个之后)...是不是 content_wrapper div 阻止了它
如果你有一个正常的形式: 然后您可以填写输入字段,然后按回车键。但是,我正在使用链接来完成我的工作: Submit 这就像一个魅力,但是,我希望它继承普通提交字段具有的“可单击输入”。这
我正在创建一个可点击 div 列表,以显示一个弹出窗口,其中包含与所点击项目相关的信息。 每个列表项都假设列表最后一项的“单击”功能。当我删除最后一项时,它们都假定新的最后一项的“单击”功能。 (例如
我正在使用来自 Google 基于 HTML5 的网络应用程序 here 的翻页演示(教程 here 和演示 20 Things I Learned about Browsers and the We
这无疑是一个愚蠢的错误,但我正在疯狂地寻找它。在下面的日历代码中,如果有事件则链接和今天的链接不可点击。 请注意,我已将超链接替换为 www.google.com。在实际应用中它指向日历的每日 Vie
我想改变这个: Moo 要符合标准(你不应该在内联元素中有 block 元素)。将 javascript 连接到 div 仅用于导航似乎是一种 hack 并且会降低可访问性。在这种情况
Fiddle . 如果您将鼠标悬停在“CLOSE”和三 Angular 形的 :after 元素之间,则您无法单击该链接。 有没有一种方法可以使该区域可点击并且看起来仍然一样? HTML: Cl
我有一个不透明度为 0 的菜单 div,可见性最初是隐藏的。我基本上希望这个 div 在单击另一个 div 时可用(它是一个粘贴在我页面顶部的菜单,可通过单击发现/隐藏)。 效果很好....一次性..
我正在开发一个图片 uploader 。我有一个使用 https://codecanyon.net/item/slim-image-upload-and-ratio-cropping-plugin/1
有没有可能制作一个可点击并相应地触发一个 Action ? 这就是我的代码的样子,我也希望能够点击子菜单。
我们什么时候应该在 XML 中使用 android:clickable?我们应该永远吗? 这样的 XML 声明和代码内声明 myButton.setOnClickListener 之间有什么区别吗?我
我只是想这可能有用,但我找不到办法。 在 Notepad++ 中,有没有办法让函数名称“可点击”——即让它们成为链接,这样如果你点击它们,它会自动将你带到它的定义(最好是跨越整个代码库)? 最佳答案
我正在尝试在网站上选择付款方式。我有三个选择:SEPA、信用卡/借记卡、PayPal。我想点击贷方/借方。 It looks like this 这些选择在一个主 div 中,每个选择都在另一个包含输
我是一名优秀的程序员,十分优秀!