if you are new in selenium webdriver and you want to learn basic about selenium webdriver.
Like how to open browser(IE, Chrome, FF), please refer below code.
1) you can download selenium jar file, from this link.
2) create a project in ecplise
3)Import jar file in your project.
public class openBrowser{
public static void main(String[] args)
{
Webdriver driver = new FirefoxDriver();
driver.get("www.google.co.in");
}
}
above code could open Firefor browser and google webpage open
Open CHROME browser :
1) you can download chrome browser driver from here
2) copy location of chrome browser and past in below code under system property attribute
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class chromebrowser
{
public static void main(String args[])
{
System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe (path of your chromedriver)");
WebDriver driver=new ChromeDriver();
driver.get("www.google.co.in");
}
}
same code for IE browser but for IE you have to download IE driver and in above code paste location of IE browser.
Like how to open browser(IE, Chrome, FF), please refer below code.
1) you can download selenium jar file, from this link.
2) create a project in ecplise
3)Import jar file in your project.
public class openBrowser{
public static void main(String[] args)
{
Webdriver driver = new FirefoxDriver();
driver.get("www.google.co.in");
}
}
above code could open Firefor browser and google webpage open
Open CHROME browser :
1) you can download chrome browser driver from here
2) copy location of chrome browser and past in below code under system property attribute
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class chromebrowser
{
public static void main(String args[])
{
System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe (path of your chromedriver)");
WebDriver driver=new ChromeDriver();
driver.get("www.google.co.in");
}
}
same code for IE browser but for IE you have to download IE driver and in above code paste location of IE browser.
No comments
Post a Comment