在下面的代码中,我试图通过使用 TestNg 的数据驱动框架工作来自动化 gmail,但我的代码 @Before 注释只执行不执行其他两个。请治愈我。
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class LoginData {
WebDriver driver;
@Test
public void login() {
driver.findElement(By.linkText("Sign in")).click();
System.out.println("hello");
}
@BeforeTest
public void beforeTest() throws Exception {
WebDriver driver=new FirefoxDriver();
driver.get("https://www.gmail.com/intl/en/mail/help/about.html");
Thread.sleep(2000);
}
@AfterTest
public void fterTest() {
driver.close();
}
}