单击按钮仅适用于调试器

问题描述 投票:1回答:1

我有一个要点击的按钮,当我正常运行测试时,他没有被“点击”当我使用调试器运行测试时,一切正常

我将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
  }
}
java selenium-webdriver testng
1个回答
0
投票

这意味着有等待的问题。

[请稍等:

    WebDriverWait wait = new WebDriverWait(driver, 60);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.""""""));
    wait.until(ExpectedConditions.elementToBeClickable((By.""""""));

在上面的代码中按按钮的按定位符放置

© www.soinside.com 2019 - 2024. All rights reserved.