Tasks | Human Interaction (Manual Tester) | WebDriver Commands |
Invoke Browser | Tester manually opens the browser Firefox, IE, chrome or Safari | WebDriver driver=new FirefoxDriver(); WebDriver driver=new SafariDriver(); WebDriver driver=new chromeDriver(); WebDriver driver=new InternetExplorerDriver();This is actually a WebDriver object instantiation and this will invoke the browser according to different WebDriver implementation. |
Load URL of Application | Tester manually type’s in the URL http://www.google.com | driver.get("http://www.google.com");Loads the given url into the browser |
Click | Tester clicks on the Search field in the Google home page | driver.findElement(By.cssSelector("#gbqfq")).click(); driver.findElement(By.cssSelector("#gbqfq")).clear();Click actually comes with clear command in WebDriver. Clear command will simply clear the input field. Basically to avoid the auto-form fill. |
Type | Tester types the words manually | driver.findElement(By.cssSelector("#gbqfq")).sendKeys("test");Types “test” into the input element identified by css selector. |
Select from Drop-down | Tester clicks on the Drop-down field and selects the required option | Select select = new Select(driver.findElement(By.tagName ("select"))); select.selectByVisibleText("Apple");Selects the text displayed as “Apple” in the select combo box which is identified by tag name “select” |
Moving between Windows | Tester will simply click on the window or will do a Alt+tab combination to toggle between windows | driver.switchTo().window("windowName"); driver.switchTo().frame("frameName");We can switch between frames or iframes using above command. |
Alert Handling | Tester knows that Alert will be pop-up and then asserts it. | driver.findElement(By.xpath (“<Xpath>”)).click(); Alert alert = driver.switchTo().alert(); alert.accept(); |
Thursday, January 9, 2014
Transformation from Manual tester to a Selenium WebDriver Automation specialist
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment