2

私は VCM に取り組んでおり、Selenium と TestNG (webdriver を使用しない) を使用していくつかのテスト スクリプトを作成しました。

問題は、ログインするとすぐに自動的にログアウトされ、リンクが見つからないというエラーが表示されることです。個々に実行するとスクリプトは完全に実行されますが、スイートを実行すると、上記のエラーが表示されて常に失敗します。

参照用の私のコードは次のとおりです。

    @BeforeTest
public void setup()
{
    selenium = new DefaultSelenium("localhost",4444,"*firefox","http://BaseURL/");
    selenium.start();
    selenium.windowMaximize();
}
@AfterTest
public void teardown()
{
    this.selenium.close();
}

@Test public void testTC_07() throws Exception {
    selenium.open("http://BaseWebsite");
    selenium.type("name=j_username", "UserId");
    selenium.type("name=j_password", "PassWord");
    selenium.click("id=login-button");
    selenium.waitForPageToLoad("60000");
    selenium.click("id=href_Menus");
    selenium.waitForPageToLoad("60000");
    selenium.click("link=TestContents");
    selenium.waitForPageToLoad("60000");
    selenium.click("link=Test");
    selenium.waitForPageToLoad("60000");
    selenium.click("link=Test_title");
    selenium.waitForPopUp("Pop Up Window", "60000");
    selenium.selectWindow("null");
    verifyEquals(selenium.getTitle(), "Test_Title Properties Window");
    verifyTrue(selenium.isTextPresent("Title"));
    selenium.type("id=textbox", "");
    Thread.sleep(10000);
    selenium.click("id=doOK");
    String title= selenium.getTitle();

    if(title!="Window Title"){
        selenium.close();
        selenium.selectWindow("null");
        selenium.click("link=Logout");
        selenium.waitForPageToLoad("60000");
        }

    else{
        TC_07.fail(null);
        this.selenium.close();

    }
}
4

0 に答える 0