【发布时间】:2021-05-28 19:37:42
【问题描述】:
我第一次尝试使用 eclipse 的 selenium 来运行 TestNG 程序 它的代码是: 当我选择使用 TestNG 运行时 我收到以下错误消息 - 我在代码下方添加 有人可以帮我解决这个问题吗? 感谢Advanecd
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class google {
@Test
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");
driver.findElement(By.xpath("//body/div[1]/div[3]/form[1]/div[2]/div[1]/div[1]/div[1]/div[2]/input[1]")).sendKeys("1234");
driver.findElement(By.cssSelector("div.L3eUgb:nth-child(2) div.o3j99.ikrT4e.om7nvf:nth-child(3) div:nth-child(2) div.A8SBwf:nth-child(1) div.FPdoLc.tfB0Bf:nth-child(4) center:nth-child(1) > input.gNO89b")).click();
}
【问题讨论】:
标签: java eclipse selenium maven testng