- Go to http://code.google.com/p/selenium/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount
Here you can download the drivers wrt to multiple browsers.
We need to download the respective browser driver.
See once you download, you tag that downloaded driver file to your script.
System.setProperty("webdriver.ie.driver", "<driver file path>") --this is for IE browser
then mention the driver object.
IE:
WebDriver driver = new InternetExplorerDriver();
Note: Disable protected mode should be mentioned in internet options some times. Disable Trusted and restricted sites.
Note for IE browser:(this helps to skip the settings in IE in some cases if browser is not openining)
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
- Firefox:
WebDriver driver = new FirefoxDriver()
This will invoke firefox browser and returns an handle in form of WebDriver object which is used to interact with browsers.
See here the above code is not similar to what we use when we create object for a class, here it is based on super and sub class.
syntax:
FirefoxDriver - is a sub class constructor ?? Not solved
WebDriver - is super class
driver - is a object
freqly used methods:
.get("<url>"); ---- helps u hit the url
.getTitle(); ---returns the page title
.close(); -- closes the window that is currently open
.quit(); --- closes every associated window. If i click link in a web page, the opens another window, so using quit, we can close all those related windows.
.findElement(By.name("email_to[]")).click();
No comments:
Post a Comment