我想在无头浏览器中进行一些测试,以测试填充表单。PhantomJS和Selenium - 在搜索元素时尝试使用等待时遇到问题
我使用,我是从下面的示例所示的代码:
github link to example of using phantomjs
我的代码:
WebDriverWait wait = new WebDriverWait(driver, 30);
driver.get("<URL HERE, left out for privacy on stack overflow!>");
By amount = By.id("amountField");
wait.until(ExpectedConditions.presenceOfElementLocated(amount));
错误的IntelliJ:
until(java.util.function<? super org.openqa.selenium.WebDriver, V) in FluentWait cannot be applied to :
(org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>)
我不是我真的很确定我在哪里错了 - 但我花了两个小时尝试解决这个问题。
元素我要找页:
<input name="amount0" id="amountField" value="" class="amount form-control" type="number" pattern="\d+(\.\d*)?" maxlength="10" placeholder="Amount">
你能对你的问题有点特别吗? 1.你的目标是什么? 2.你想达到什么目的? 3.为什么你需要一个明确的等待? 4.它是一个隐藏的元素? 5.它是如何出现的? 6.提供HTML DOM。 – DebanjanB
请将上面的内容作为流利等待而不是显式等待。 – DebanjanB
试图测试填写表单,我需要流利的等待,因为phantomjs似乎试图在加载之前获取元素。元素不隐藏。它显示为一个测试框。不幸的是,我没有完整的DOM页面,但是现在将该元素粘贴到主要问题中。 – MickeyThreeSheds