Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.

Similar presentations


Presentation on theme: "Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel."— Presentation transcript:

1 Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel

2 2 Day 2 Locating Elements

3  Required for most Selenium commands  assertText  storeSelectOptions  click  type and many others  Identifies an element in the content of the web application  Consists of the location strategy followed by the location ◦ locatorType=location

4  Locators starting with “document” will use the DOM locator strategy  dom = document.forms[0].username  document.forms[0].elements['username‘]  Locators starting with “//” will use the XPath locator strategy  //input[@name='continue'][@type='button']  xpath=/html/body/form/input[4]  Locators that don’t specify a valid locator type will default to using the identifier locator.  identifier=loginForm  username

5 CSS selectors can be used by Selenium as another locating strategy  To locate css class append the class name to the parent tag name using a period (.)  To locate css id append the id name to the parent tag name using a pound sign (#)  To locate by property, include the property name and value in square brackets next to the parent tag name. css=input.required passfield [type=“password"] css=input.required passfield [type=“password"] css=input [name="username"] css=input [name="username"] css=form#loginForm

6  CSS: http://www.w3.org/TR/css3-selectors/  Xpath http://www.w3schools.com/Xpath/ http://www.w3.org/TR/xpath  Also PDF and PDFPDF


Download ppt "Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel."

Similar presentations


Ads by Google