gpt4 book ai didi

java - 使用 Selenium Java 无法到达元素的 xPath

转载 作者:行者123 更新时间:2023-12-01 06:04:03 25 4
gpt4 key购买 nike

我基本上已经尝试了所有可能的方法,但我找不到将 key 发送到以下信用卡字段的方法。我相信这是因为需要先单击该字段,但我什至无法选择该字段来单击它。非常感谢任何帮助。

网站链接:https://givingday.northeastern.edu/pages/giving-page-2

点击字段之前的 HTML:

<form accept-charset="UTF-8" action="javascript:void(0);" id="number-form" onsubmit="return false;">
<label for="card_number" class="visuallyhidden" id="number_label">Card Number</label>
<input type="text" pattern="[0-9]*" name="card_number" id="card_number" autocomplete="off" size="19" style="width: 100%; height: 2.5em; border-radius: 2px; border: 1px solid rgb(226, 226, 226); font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; padding-left: 5%; font-size: 14px; color: rgb(51, 51, 51); box-sizing: border-box;">

点击字段后的 HTML:

<form accept-charset="UTF-8" action="javascript:void(0);" id="number-form" onsubmit="return false;" _lpchecked="1">
<label for="card_number" class="visuallyhidden" id="number_label">Card Number</label>
<input type="text" pattern="[0-9]*" name="card_number" id="card_number" autocomplete="off" size="19" style="width: 100%; height: 2.5em; border-radius: 2px; border: 1px solid rgb(226, 226, 226); font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; padding-left: 5%; font-size: 14px; color: rgb(51, 51, 51); box-sizing: border-box;">

<pre id="_h#2" style="white-space: pre-wrap; position: absolute; z-index: -9; visibility: hidden; display: block; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; font-size: 14px; font-weight: 400; font-style: normal; text-transform: none; text-decoration: none solid rgb(51, 51, 51); letter-spacing: normal; word-spacing: 0px; line-height: normal; text-align: start; vertical-align: baseline; direction: ltr; width: 335px; height: 35px; margin: 0px; padding: 1px 1px 1px 16.75px; border-width: 1px; border-style: solid; overflow: auto; left: 0px; top: 0px;"><span>​</span> </pre>

最佳答案

根据我的假设,以最简单、最不可重用的方式,您将需要:

driver.switchTo.frame('spreedly-number-frame-9064')
driver.findElement(by.id('card_number')).click

关于java - 使用 Selenium Java 无法到达元素的 xPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49788442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com