- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在自动化一个网络应用程序,我必须在其中填写信用卡详细信息才能完成结帐过程。我能够成功输入信用卡号,但它在应用程序中显示验证错误,表明信用卡号无效。虽然我手动输入了数字,但它没有显示。
这是 HTML:
<div dimensions="[object Object]" style="box-sizing: border-box; display: flex; align-items: stretch; flex-flow: row wrap; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 1; border-style: solid; border-width: 0px; position: relative; min-height: 0px; min-width: 0px; flex-grow: 1;"><label for="cardNumber"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: row; flex-shrink: 0; border-style: solid; border-width: 1px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; height: 60px; justify-content: space-between; padding: 15px; background-color: rgb(255, 255, 255); border-color: rgb(150, 147, 145); border-top-left-radius: 5px; border-top-right-radius: 5px; width: 508px;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; align-self: center; height: 20px; padding-right: 15px;"><svg focusable="false" height="20" width="20"><g transform="translate(0, 0) scale(1)"><path d="M17,16 L3,16 C2.449,16 2,15.551 2,15 L2,9 L18,9 L18,15 C18,15.551 17.551,16 17,16 M3,4 L17,4 C17.551,4 18,4.449 18,5 L18,6 L2,6 L2,5 C2,4.449 2.449,4 3,4 M17,2 L3,2 C1.346,2 0,3.346 0,5 L0,15 C0,16.654 1.346,18 3,18 L17,18 C18.654,18 20,16.654 20,15 L20,5 C20,3.346 18.654,2 17,2" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></path><path d="M16,12.5 C16,13.329 15.329,14 14.5,14 C13.671,14 13,13.329 13,12.5 C13,11.671 13.671,11 14.5,11 C15.329,11 16,11.671 16,12.5" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></path><path d="M13,12.5 C13,13.329 12.329,14 11.5,14 C10.671,14 10,13.329 10,12.5 C10,11.671 10.671,11 11.5,11 C12.329,11 13,11.671 13,12.5" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></path></g></svg></div><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 1; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; flex-grow: 0; top: -16px; width: 100%;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; background-color: rgba(255, 255, 255, 0); margin-left: 0px; pointer-events: none; padding-left: 0px; width: 100%; transform: translateY(14px);"><span style="max-width: 100%; color: rgb(120, 117, 115); font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif; font-weight: 400; font-size: 16px; line-height: 30px; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: 100%; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision; text-size-adjust: none;">Card Number</span></div><input id="cardNumber" name="cardNumber" data-cid="card-number-field" autocomplete="cc-number" type="tel" pattern="[0-9]*" spellcheck="false" value="" style="background-color: transparent; border: none; box-sizing: border-box; outline: none; width: 100%; box-shadow: none; caret-color: rgb(72, 123, 148); color: rgb(23, 23, 23); font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif; font-weight: 500; font-size: 16px; height: 60px; overflow: hidden; padding-left: 0px; padding-top: 20px; position: absolute; text-overflow: ellipsis; top: 0px; white-space: nowrap; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision; transform: translateY(0px);"></div></div></label></div><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 1; border-style: solid; border-width: 0px; position: relative; min-height: 0px; min-width: 0px; flex-grow: 1;"><label for="expire"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: row; flex-shrink: 0; border-style: solid; border-width: 1px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; height: 60px; justify-content: space-between; padding: 15px; background-color: rgb(255, 255, 255); border-color: rgb(150, 147, 145); border-bottom-left-radius: 5px; margin-top: -1px; width: 254px;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; align-self: center; height: 20px; padding-right: 15px;"><svg focusable="false" width="20" height="20"><g transform="translate(0, 0) scale(1)"><path d="M16,17 L4,17 C3.448,17 3,16.551 3,16 L3,9 L17,9 L17,16 C17,16.551 16.552,17 16,17 Z M5,4 L5,5 L7,5 L7,4 L13,4 L13,5 L15,5 L15,4 L17,4 L17,7 L3,7 L3,4 L5,4 Z M15,2 L15,1 L13,1 L13,2 L7,2 L7,1 L5,1 L5,2 L1,2 L1,16 C1,17.654 2.346,19 4,19 L16,19 C17.654,19 19,17.654 19,16 L19,2 L15,2 Z" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></path><polygon points="5 14 9 14 9 11 5 11" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></polygon></g></svg></div><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 1; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; flex-grow: 0; top: -16px; width: 100%;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; background-color: rgba(255, 255, 255, 0); margin-left: 0px; pointer-events: none; padding-left: 0px; width: 100%; transform: translateY(14px);"><span style="max-width: 100%; color: rgb(120, 117, 115); font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif; font-weight: 400; font-size: 16px; line-height: 30px; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: 100%; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision; text-size-adjust: none;">MM / YY</span></div><input id="expire" name="expire" config="[object Object]" data-cid="card-expire-field" autocomplete="cc-exp" pattern="[0-9]*" spellcheck="false" type="tel" value="" style="background-color: transparent; border: none; box-sizing: border-box; outline: none; width: 100%; box-shadow: none; caret-color: rgb(72, 123, 148); color: rgb(23, 23, 23); font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif; font-weight: 500; font-size: 16px; height: 60px; overflow: hidden; padding-left: 0px; padding-top: 20px; position: absolute; text-overflow: ellipsis; top: 0px; white-space: nowrap; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision; transform: translateY(0px);"></div></div></label></div><input autocomplete="cc-exp-month" tabindex="-1" style="background-color: transparent; border: none; box-sizing: border-box; outline: none; width: 100%; opacity: 0; pointer-events: none; position: fixed; z-index: -1; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision;"><input autocomplete="cc-exp-year" tabindex="-1" style="background-color: transparent; border: none; box-sizing: border-box; outline: none; width: 100%; opacity: 0; pointer-events: none; position: fixed; z-index: -1; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision;"></div><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 1; border-style: solid; border-width: 0px; position: relative; min-height: 0px; min-width: 0px; flex-grow: 1;"><label for="securityCode"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: row; flex-shrink: 0; border-style: solid; border-width: 1px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; height: 60px; justify-content: space-between; padding: 15px; background-color: rgb(255, 255, 255); border-color: rgb(150, 147, 145); border-bottom-right-radius: 5px; width: 255px; margin-left: -1px; margin-top: -1px;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; align-self: center; height: 20px; padding-right: 15px;"><svg focusable="false" height="20" width="20"><g transform="translate(0, 0) scale(1)"><path d="M15,15.547 C15,15.767 14.926,15.984 14.791,16.159 L13.669,17.611 C13.481,17.854 13.185,18 12.878,18 L7.122,18 C6.815,18 6.519,17.854 6.331,17.611 L5.209,16.159 C5.074,15.984 5,15.767 5,15.547 L5,10 L15,10 L15,15.547 Z M6,6 C6,3.794 7.794,2 10,2 C12.206,2 14,3.794 14,6 L14,8 L6,8 L6,6 Z M16,8 L16,6 C16,2.691 13.309,0 10,0 C6.691,0 4,2.691 4,6 L4,8 L3,8 L3,15.547 C3,16.208 3.222,16.859 3.626,17.381 L4.748,18.834 L4.749,18.834 C5.313,19.564 6.2,20 7.122,20 L12.878,20 C13.8,20 14.688,19.564 15.252,18.834 L16.374,17.381 C16.778,16.859 17,16.208 17,15.547 L17,8 L16,8 Z" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></path><polygon points="9 16 11 16 11 12 9 12" fill="rgba(120, 117, 115, 1)" style="transition: fill 0.2s ease 0s;"></polygon></g></svg></div><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 1; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; flex-grow: 0; top: -16px; width: 100%;"><div style="box-sizing: border-box; display: flex; align-items: stretch; flex-direction: column; flex-shrink: 0; border-style: solid; border-width: 0px; position: relative; z-index: 0; min-height: 0px; min-width: 0px; background-color: rgba(255, 255, 255, 0); margin-left: 0px; pointer-events: none; padding-left: 0px; width: 100%; transform: translateY(14px);"><span style="max-width: 100%; color: rgb(120, 117, 115); font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif; font-weight: 400; font-size: 16px; line-height: 30px; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: 100%; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision; text-size-adjust: none;">CVC</span></div><input id="securityCode" name="securityCode" data-cid="card-security-code-field" autocomplete="cc-csc" type="tel" pattern="[0-9]*" spellcheck="false" value="" style="background-color: transparent; border: none; box-sizing: border-box; outline: none; width: 100%; box-shadow: none; caret-color: rgb(72, 123, 148); color: rgb(23, 23, 23); font-family: "Klarna Text", "Klarna Sans", Helvetica, Arial, sans-serif; font-weight: 500; font-size: 16px; height: 60px; overflow: hidden; padding-left: 0px; padding-top: 20px; position: absolute; text-overflow: ellipsis; top: 0px; white-space: nowrap; -webkit-font-smoothing: antialiased; text-rendering: geometricprecision; transform: translateY(0px);"></div></div></label></div></div>
我尝试使用-
Action 类
public void typeInField(String locator, String value) {
String val = value;
QAFWebElement element = getDriver().findElement(locator);
element.clear();
StringBuilder s = new StringBuilder();
for (int i = 0; i < val.length(); i++) {
char c = val.charAt(i);
s = s.append(c);
new Actions(getDriver()).sendKeys(element, s.toString()).build().perform();
}
}
2.JavascriptExecutor
getDriver().executeScript("arguments[0].value='" + data.get("number2").toString() + "';",
getDriver().findElement("checkout.cardnumber.textbox"));
3.发送 key
但似乎应用程序将所有这三个检测为机器人操作而不是人类操作。还有其他方法可以模拟相同的 Action 吗?
最佳答案
目前以下解决方案对我有用。
new Actions(getDriver()).sendKeys(getDriver().findElement(locator), Keys.chord(Keys.CONTROL, "a", Keys.DELETE),"value_to_enter").build().perform();
期待得到更多答案。
关于java - 如何在selenium中模拟真实的按键输入 Action ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58949847/
我正在寻找x86 Assembly中pow(real, real)的实现。我也想了解算法的工作原理。 最佳答案 只需将其计算为2^(y*log2(x))即可。 有一个x86指令FYL2X计算y *
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 11 年前。 Improve thi
风格指南的最后一点 http://www.python.org/dev/peps/pep-0008 读... 不要使用 == 将 bool 值与 True 或 False 进行比较。 为什么? 编辑只
我似乎无法完成这件事。我仍然在我的日志中看到 cloudflare IP。目前,我有一个负载均衡器,它位于 Cloudflare 后面。 目前,这是与 forwardfor 相关的块: opt
此代码行选择任何类名不是“id”和“quantity”的 div 内的所有子输入:: $("div.item > div:not(.id,.quantity) > :input").live("key
我在测试真实产品时遇到错误。当我单击购买按钮时,出现错误“此版本的应用程序未配置为市场计费”。 我用这个例子https://github.com/robotmedia/AndroidBillingLi
到目前为止我能找到的所有答案都建议调用 omp_set_num_threads。虽然在大多数情况下这是一个正确的答案,但它对我不起作用。在内部,调用 omp_set_num_threads 会导致创建
假设我有 3 个显示器。如何仅通过其索引获取第二个句柄? EnumDisplayMonitors() 不会工作,因为它也枚举了伪设备,而 EnumDisplayDevices() 没有给我句柄。 最佳
我一直在尝试制作一个简单的小游戏来测试我的逻辑,这是一个简单的迷宫,它很丑,而且到目前为止很糟糕。 引擎工作得很好,考虑到迷宫已经存在(矩阵),它甚至可以愉快,但我无意绘制一堆 map ,这可能是在
Cloudflare 代理包含一个名为 CF-Connecting-IP 的 header 和用户的真实 IP。我想让 traefik 读取这个 header 并用它的内容创建一个 X-Real-Ip
我想要上下文菜单中的不同菜单项,具体取决于我在 JTable 中单击的行 大多数示例并没有真正显示上下文菜单(应该根据上下文 - 所选行进行填充) 我尝试过这个: popupMenu = ne
我有一个对象 callInst。如何获取函数的真实名称而不是 IR 代码中的名称?如果我在我的通行证中运行此代码(Useless 在另一个问题中发布) StringRef get_function_n
我在 Appium 和 iPad 2 上使用了以下所需的功能 DesiredCapabilities capabilities = new DesiredCapabilities(); capabil
根据documentation 我们可以通过以下方式在模拟器上运行我们的 android 项目: cordova 运行 android 或 cordova emulate android 但是如何在真
在 ASP.NET 中,有没有办法获得真正的原始 URL? 例如,如果用户浏览到“http://example.com/mypage.aspx/%2F”,我希望能够获得“http://example.
我的 NSInputStream 遇到问题。这是我的代码: case NSStreamEventHasBytesAvailable: printf("BYTE AVAILABLE\n"
$(selector).click() 结果没有任何反应。 this answer在浏览器控制台中工作,javascript 上下文设置为 iframe,但不是主页: simulateMouseCli
我在我的 AB Micro820 PLC 中设置了 modbus 映射。我在 40001 中有一个数组用于写入,在 42001 中有一个数组用于读取。两者都是 200 个元素和 REAL 类型(32
我正在寻找有关设计契约(Contract)管理数据模型的建议。因此,合约的一般生命周期是: 契约(Contract)已创建并处于“草稿”状态。它可以在内部查看,并且可以进行更改。 契约(Contrac
我正在尝试让我的 WebView fullscreen 达到标准,我知道如何将它拉伸(stretch)到“全屏”,但我想做的是当您长按 WebView 并选择全屏选项时,创建全屏。有谁知道该怎么做?
我是一名优秀的程序员,十分优秀!