3

我正在编写一个 selenium 测试,我正在检查网站的 UI 和功能。在功能中,我在输入块中输入用户名和密码,并希望单击登录按钮。除了登录按钮外,一切正常。点击也是发生,但它不会重定向到正确的页面。它总是重定向

http://vma-dev.saas.trilogy.com/favicon.ico " 其中 http://vma-dev.saas.trilogy.com是我的基本网址。我正在使用以下代码.. 使用以下功能登录。 .

public void getLogin() throws InterruptedException 
{
    enterTextValueByElementNameInWindow(getBaseElement(),AppConstants.Html_Id_Common_Text_User ,AppConstants.USER_VAL);
    //getBaseElement().keyUp(AppConstants.Html_Id_Common_Text_User,"m");
    enterTextValueByElementNameInWindow(getBaseElement(),AppConstants.Html_Id_Common_Text_PWD ,AppConstants.PASSWORD_VAL);
    //getBaseElement().keyUp(AppConstants.Html_Id_Common_Text_PWD,"3");
    clickByElementInWindow(getBaseElement(), AppConstants.Html_Id_Common_Btn_Text_SignIn, true);
    try
    {
        getBaseElement().wait(10000);
    }
    catch(IllegalMonitorStateException ie)
    {

    }

}

并单击登录按钮,我正在使用以下功能..

public static void clickByElementInWindow(LoggingSelenium appWindow, String element, boolean waitForPageLoad) 
{
    LoggingAssert.assertTrue("Button Element " + element + " cannot be located",appWindow.isElementPresent(element), appWindow);
    LoggingAssert.assertTrue("Button Element " + element + " is not visible",appWindow.isVisible(element), appWindow);
    appWindow.click(element);
    appWindow.setSpeed("500");
    if (waitForPageLoad){
        // wait for page to be ready
        // appWindow.waitForPageToLoad(Integer.toString(AppConstants.APP_READY_TIME));

        // sometimes page doesn't get loaded even with waitForPageToLoad. Use sleep to be safe. 
        try
        {    
            Thread.sleep(AppConstants.APP_PAGE_LOAD_WAIT_TIME);    
        }
        catch(InterruptedException ie)
        {
            // do nothing
        }
    }
}

我被严重困在这里。任何帮助都会得到帮助。

4

0 回答 0