1 / 12

CSCE 747 Software Testing and Quality Assurance

CSCE 747 Software Testing and Quality Assurance. Lecture 19 Selenium Web Driver. Last Time GUI testing 2 Chapter 19. Today Test 1 take-home TestingGeek Testing Web Applications Selenium. Chapter 2. Working with Selenium API. Checking an element's text

wylie
Download Presentation

CSCE 747 Software Testing and Quality Assurance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCE 747 Software Testing and Quality Assurance Lecture 19 Selenium Web Driver

  2. Last Time • GUI testing 2 • Chapter 19 Today • Test 1 take-home • TestingGeek • Testing Web Applications • Selenium

  3. 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

  4. 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

  5. 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

  6. 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'sWebElement 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

  7. @Test public void testElementText() {   //Get the message Element    WebElementmessage = 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

  8. assertTrue(messageText.contains("color")); assertTrue(messageText.startsWith("Click on")); assertTrue(messageText.endsWith("will change")); Selenium Testing Tools Cookbook by Gundecha – 2012

  9. Checking an element's attribute values @Test public void testElementAttribute(){ WebElementmessage = driver.findElement( By.id("message"));    assertEquals("justify", message.getAttribute("align")); } Selenium Testing Tools Cookbook by Gundecha – 2012

  10. Checking an element's CSS values @Test public void testElementStyle() {    WebElementmessage = driver.findElement( By.id("message"));    String width = message.getCssValue( "width");    assertEquals("150px",width); } Selenium Testing Tools Cookbook by Gundecha – 2012

  11. Selenium Testing Tools Cookbook by Gundecha – 2012

  12. Selenium Testing Tools Cookbook by Gundecha – 2012

More Related