Reputation: 13
I'm new with using Java, Selenium en the Webdriver
I use: selenium 3 beta3, Java jdk1.8.0_101 and firefox 48.01 Also I use the Geckodriver because that is needed for working with sel3.
I am trying to open a url. Opening the browser is working. The code I use is below.
package AutomatedScripts;
import org.openqa.selenium.WebDriver; // driver for Webdriver
import org.openqa.selenium.firefox.FirefoxDriver; //driver for Firefox
public class GoogleSearchOneTime {
public static void main(String[] agrs) {
System.setProperty("webdriver.firefox.marionette","C:\\selenium-3.0.0\\geckodriver\\geckodriver.exe");
// Launch a firefox browser
WebDriver driver = new FirefoxDriver();
// go to Google.com
driver.get("http://www.google.com");
// go to google.com
// driver.navigate().to("http://www.google.com");
//Enter search terms
//driver.findElement(By.id("lst-ib")).clear();
//driver.findElement(By.id("lst-ib")).sendKeys("Google");
//Click on the searh button
//driver.findElement(By.name("btnG")).click();
//check page title contacts the search term
}
}
Upvotes: 0
Views: 448
Reputation: 670
Replace you System.setProperty as below
System.setProperty("webdriver.gecko.driver", "C:\\selenium-3.0.0\\geckodriver\\geckodriver.exe");
Here an example link that you can refer Launching firefox browser using Geckodriver
Upvotes: 2