0
我在TESTNG中很新。 我做了一個檢查成功登錄的測試方法。 但我怎麼才能繼續下去,而不關閉瀏覽器,即使用相同的瀏覽器。我想按順序運行測試,即登錄後將執行下一個測試。如果我添加一個新的方法在現有的類然後它不運行在同一瀏覽器中。TESTNG測試運行序列
@BeforeMethod
public void beforeMethod() throws Exception
{
//setting paths from env property file
driverPath = read_trans.getProperty("driverPath");
System.setProperty("webdriver.chrome.driver",driverPath+"chromedriver.exe");
driver = new ChromeDriver();
}
@Test
public void check_successfull_login() throws InterruptedException
{
String TestCaseName="L1";
//TestCaseName = read_trans.getProperty("TestCaseName");
excel_read dp=new excel_read();
String[] credentials=dp.get_credentials(TestCaseName);
driver.manage().window().maximize();
read_trans.getProperty("URL");
//System.out.println(A);
driver.navigate().to(read_trans.getProperty("URL"));
wait = new WebDriverWait(driver,5);
driver.findElement(By.xpath("//div[@class='navbar']/a")).click();
driver.findElement(By.xpath("//div[@class='navbar']/div[2]/ul/a")).click();
driver.findElement(By.xpath("//div[@class='pan")).sendKeys(credentials[0]);
driver.findElement(By.xpath("//input[@.....']")).sendKeys(credentials[1]);
driver.findElement(By.xpath("//button[@class='btn ....']")).click();
} `