1

我的应用程序将 Paypal 作为支付选项,在使用 Selenium Web Driver 进行自动化测试时,流程继续进行,没有任何错误,但是当流程导航到 Paypal 登录页面时,填写所有字段(用户名、密码),然后单击登录按钮,EXPECTED FLOW Is: page redirects to order confirm page, but the Paypal login page get refresh and stay on the page with empty fields. _ 我还通过增加超时秒数来检查它,但没有任何反应。下面是我的代码:

@Test
    public void testAsdChannel(){
        for(RemoteWebDriver driver: drivers){
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            HomePage hPage = HomePage.navigateTo(driver, SERVER);
            ....
            AsdConfirmPage asdPage = asdChannelFlow.acceptOffer();
            asdChannelPage.paypalLogin("username", "pswd"); 
            Assert.assertEquals(asdConfirmPage.asdOrderConfirm(), "Your order has been received");
             }
    }

// 下面我提供 paypalLogin(String userName, String pswd) 方法:

public void paypalLogin(String username, String password){
        paypalEmail.sendKeys(username); // 'paypalEmail'text field element on paypal login page
        paypalPswd.sendKeys(password); // 'paypalPswd' field element on same.
        paypalLoginBtn.submit(); // 'paypalLoginBtn' button element on same
    }

// 这里是元素 paypalLoginBtn, paypalPswd, paypalEmail

    @FindBy(name = "email")
    WebElement paypalEmail;

    @FindBy(name = "password")
    WebElement paypalPassword;

    @FindBy(id = "loginButton")
    WebElement paypalLoginBtn;

请提出任何解决此问题的方法............在此先感谢。

4

0 回答 0