Lec 19 Web Driver 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 19 Selenium Web Driver 11/4/2013 1
Lec 19 Web Driver 2 CSCE 747 Fall 2013 Last Time GUI testing 2 Chapter 19 Today Test 1 take-home TestingGeek Testing Web Applications Selenium
Lec 19 Web Driver 3 CSCE 747 Fall 2013 Chapter 2. Working with Selenium API Checking an element's text Checking an element's attribute values Checking an element's CSS values Using Advanced User Interactions API for mouse and keyboard events Performing double-click on an element Performing drag-and-drop operations Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 4 CSCE 747 Fall 2013 Executing JavaScript code Capturing screenshots with Selenium WebDriver Capturing screenshots with RemoteWebDriver/Grid Maximizing the browser window Automating dropdowns and lists Checking options in dropdowns and lists Checking selected options in dropdowns and lists Automating radio buttons and radio groups Automating checkboxes Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 5 CSCE 747 Fall 2013 Controlling a Windows process Reading a Windows registry value from Selenium WebDriver Modifying a Windows registry value from Selenium WebDriver Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 6 CSCE 747 Fall 2013 Checking an element's text While testing a web application, we need to verify that elements are displaying correct values or text on the page. Selenium WebDriver's WebElement API provides various ways to retrieve and verify text. Sometimes, we need to retrieve text or value from an element into a variable at runtime and later use it at some other place in the test flow. using the WebElement class' getText() method. Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 7 CSCE 747 Fall public void testElementText() { //Get the message Element WebElement message = driver.findElement(By.id("message")); //Get the message elements text String messageText = message.getText(); //Verify message element's text displays … assertEquals("Click on me and my color will change", messageText); Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 8 CSCE 747 Fall 2013 assertTrue(messageText.contains("color")); assertTrue(messageText.startsWith("Click on")); assertTrue(messageText.endsWith("will change")); Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 9 CSCE 747 Fall 2013 Checking an element's attribute public void testElementAttribute(){ WebElement message = driver.findElement( By.id("message")); assertEquals("justify", message.getAttribute("align")); } Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 10 CSCE 747 Fall 2013 Checking an element's CSS public void testElementStyle() { WebElement message = driver.findElement( By.id("message")); String width = message.getCssValue( "width"); assertEquals("150px",width); } Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 11 CSCE 747 Fall 2013 Selenium Testing Tools Cookbook by Gundecha – 2012
Lec 19 Web Driver 12 CSCE 747 Fall 2013 Selenium Testing Tools Cookbook by Gundecha – 2012