点击贝宝按钮,硒不起作用

时间:2021-03-17 00:14:49

标签: javascript node.js selenium selenium-webdriver paypal

我在使用 Selenium 时遇到问题,无法按此 PayPal 按钮。

enter image description here

HTML

我尝试了 Selenium 文档中的所有方法,但不幸的是它没有按下它。我什至使用了普通的 findElement 方法,但不幸的是没有反应。

这是我现在的代码行:

await driver.wait(until.elementLocated(By.xpath('//*[@id="paypal-animation-content"]/div[1]/div'))).click();

我正在等待按钮,但它也无济于事。我还用 findElement(By.className)

搜索了课程

有没有人有这方面的经验并且可以帮助我?

1 个答案:

答案 0 :(得分:1)

可以试试用js点击

var xPathPaypal = "xpath goes here"
var paypalButton = driver.FindElementByXPath(xPathPaypal);
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", paypalButton);
相关问题