documentation of selenium:
http://selenium.googlecode.com/git/docs/api/java/index.html
download webdriver jar files and configure in eclipse
Selenium we configure in eclipse..
Web driver is an interface in selenium tool api..
interface has lot of functions..
Firefox driver:
//FirefoxDriver dr1= new FirefoxDriver();
//sometimes firefox will have problmes with binaries in that case download binaries and use below code
//FirefoxBinary br= new FirefoxBinary("c:\\meeraja");
//FirefoxDriver dr1= new FirefoxDriver(br,null);
// To open a chrome driver,
System.setProperty("webdriver.chrome.driver", "c:\\meeraja\\chromedriver.exe");
ChromeDriver dr2= new ChromeDriver();
// To open a IE driver, System.setProperty("webdriver.ie.driver", "c:\\meeraja\\IEDriverServer.exe"); InternetExplorerDriver dr3= new InternetExplorerDriver();
sometime there is problem with protected mode, go ie tools, options and security select the same protection mode for all zones
Firefox Profiling: customize u r firefox browser accordingly..
file-exit in firefox.. in run, type firefox.exe -p profilemanager and create profile
use Ini class
ProfileIni prof= new ProfilesIni();
Firefox Profile p= prof.getProfile("Meeraja");
FirefoxDriver dr9= new FirefoxDriver(p);
driver.close() ; //will close firefox window
driver.quit() ; // close all ff windows associated with driver
Import documentation in Eclipse,
http://docs.seleniumhq.org/download/ right click on javadoc and copy the link addreess
http://selenium.googlecode.com/git/docs/api/java/index.html
go to java build path of your project and in under libraries , search for selenium -java 2.41.0.jar and expand and under javadoc location edit ,copy this file location, and at end of url plz remove index.html
http://selenium.googlecode.com/git/docs/api/java/ and click ok
Desired Capabilities:
DesiredCapabilities dc= new DesiredCapabilities(); dc.setJavascriptEnabled(true); FirefoxDriver fd= new FirefoxDriver(dc);
dc.setCapability (type ,value) //like to handle ssl certificate types and all..
Remote web driver: for grid we use, we use desired capabilities in remote web driver
proxy: is a class
proxy.setPrxyAutoconfigurl("url")
DesiredCapabilities dc= new DesiredCapabilities();
dc.setcapability(capailitytype.browsername,firefox)
dc.setcapability(capabilitytype.proxy,proxy)
FirefoxDriver fd= new FirefoxDriver(dc);
fd.get("http:\\google.com");
HTML Unit driver: u can emulate any type of browser version with this..
HtmlUnitDriver Hd= new HtmlUnitDriver(BrowserVersion.FIREFOX_17); Hd.get("http:\\google.com"); System.out.println(Hd.getTitle());
http://selenium.googlecode.com/git/docs/api/java/index.html
download webdriver jar files and configure in eclipse
Selenium we configure in eclipse..
Web driver is an interface in selenium tool api..
interface has lot of functions..
Firefox driver:
//FirefoxDriver dr1= new FirefoxDriver();
//sometimes firefox will have problmes with binaries in that case download binaries and use below code
//FirefoxBinary br= new FirefoxBinary("c:\\meeraja");
//FirefoxDriver dr1= new FirefoxDriver(br,null);
// To open a chrome driver,
System.setProperty("webdriver.chrome.driver", "c:\\meeraja\\chromedriver.exe");
ChromeDriver dr2= new ChromeDriver();
// To open a IE driver, System.setProperty("webdriver.ie.driver", "c:\\meeraja\\IEDriverServer.exe"); InternetExplorerDriver dr3= new InternetExplorerDriver();
sometime there is problem with protected mode, go ie tools, options and security select the same protection mode for all zones
Firefox Profiling: customize u r firefox browser accordingly..
file-exit in firefox.. in run, type firefox.exe -p profilemanager and create profile
use Ini class
ProfileIni prof= new ProfilesIni();
Firefox Profile p= prof.getProfile("Meeraja");
FirefoxDriver dr9= new FirefoxDriver(p);
driver.close() ; //will close firefox window
driver.quit() ; // close all ff windows associated with driver
Import documentation in Eclipse,
http://docs.seleniumhq.org/download/ right click on javadoc and copy the link addreess
http://selenium.googlecode.com/git/docs/api/java/index.html
go to java build path of your project and in under libraries , search for selenium -java 2.41.0.jar and expand and under javadoc location edit ,copy this file location, and at end of url plz remove index.html
http://selenium.googlecode.com/git/docs/api/java/ and click ok
Desired Capabilities:
DesiredCapabilities dc= new DesiredCapabilities(); dc.setJavascriptEnabled(true); FirefoxDriver fd= new FirefoxDriver(dc);
dc.setCapability (type ,value) //like to handle ssl certificate types and all..
Remote web driver: for grid we use, we use desired capabilities in remote web driver
proxy: is a class
proxy.setPrxyAutoconfigurl("url")
DesiredCapabilities dc= new DesiredCapabilities();
dc.setcapability(capailitytype.browsername,firefox)
dc.setcapability(capabilitytype.proxy,proxy)
FirefoxDriver fd= new FirefoxDriver(dc);
fd.get("http:\\google.com");
HTML Unit driver: u can emulate any type of browser version with this..
HtmlUnitDriver Hd= new HtmlUnitDriver(BrowserVersion.FIREFOX_17); Hd.get("http:\\google.com"); System.out.println(Hd.getTitle());