我有一个要点击的按钮,
当我正常运行测试时,他没有被“点击”
当我使用调试器运行测试时,一切正常
我将implicitlyWait
设置为30秒,即使更改了它也没有任何作用,
我的问题是当我单击“下一步”按钮
这是站点代码:
<div class="b24-network-auth-form-btn-block">
<input style="display: none;" name="login" value="user">
**<button class="ui-btn ui-btn-md ui-btn-success ui-btn-round b24-network-auth-form-btn" data-action="submit">Next</button>**
<button class="ui-btn ui-btn-md ui-btn-light ui-btn-round b24-network-auth-form-btn" data-action="forgot">Forgot password?</button>
</div>
这是我的测试
public class LoginPage extends Base
{
@FindBy(id="login")
public WebElement txtUserName; //user name
@FindBy(xpath="/html//div[@id='authorize-layout']/div/div[3]//form//button[.='Next']")
public WebElement btnNext; //"next" button
@FindBy(id="password")
public WebElement txtPassword; //password
public void login(String sUser, String sPass) throws ParserConfigurationException, SAXException, IOException
{
Update.text(txtUserName,"User Name",sUser); //type the user name
Click.click(btnNext, "Next button"); //click the "next" button
Update.text(txtPassword, "Password", sPass); //type the "password" button
Click.click(btnNext, "Next button"); //click the "next" button
}
}
答案 0 :(得分:0)
这意味着存在等待问题。
请稍等:
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.""""""));
wait.until(ExpectedConditions.elementToBeClickable((By.""""""));
在上述代码中将按钮的“按位置”放置