2

次のステートメントをどこに追加すればよいですか System.setProperty("webdriver.gecko.driver","//home//tuser//software//selenium//gecko_driver//geckodriver");

私のコードがエラーを生成しないように

public class class1 {

public static String baseURL = "https://facebook.com/";
public WebDriver driver = new FirefoxDriver();

@Test(priority = 1)
public void login() throws InterruptedException {

    driver.get(baseURL);
    driver.manage().window().maximize();
    driver.findElement(By.id("username")).sendKeys("srikanth");
    driver.findElement(By.id("password")).sendKeys("sri");
    driver.findElement(By.id("login_button")).click();
    Thread.sleep(30000);
}
4

3 に答える 3

0

以下のスニペットを参照してください

public class class1 {
@Test(priority = 1)
public void login() throws InterruptedException {
    String baseURL = "https://facebook.com/";
    System.setProperty("webdriver.gecko.driver","C:\\Selenium Training\\Practice\\Firefox driver\\geckodriver.exe"); //Make sure to provide .exe extn
    WebDriver driver = new FirefoxDriver();
    driver.get(baseURL);
    driver.manage().window().maximize();
    driver.findElement(By.id("email")).sendKeys("srikanth");
    driver.findElement(By.id("pass")).sendKeys("sri");
    driver.findElement(By.id("u_0_n")).click();
    Thread.sleep(30000);
    }
  }
于 2016-12-21T07:19:09.783 に答える