Watch this example-filled webinar that will help you write efficient CSS selectors for your Selenium tests – with test automation expert Corina Pip.
When writing Selenium tests, in order to get a handle to the page elements you need to interact with, WebElement variables need to be created. They are based on selectors, which uniquely identify the HTML page elements you need in your tests.
The easiest selectors to write are the CSS ones.
In this webinar, packed full of real-world practical and actionable examples, Corina first covered the most commonly used CSS selectors.
Then, Corina showed strategies for writing short and reliable selectors, aimed at identifying elements even in the most complex and seemingly impossible HTML structure.
Corina’s slides:
Full webinar recording:
Corina asked us to share with you some of her additional & recommended resources:
- The HTML presented in the webinar, which can also be opened in the browser and inspected:
- The PageObject class presented in the webinar
- The tests Corina showed in the session
- Information on HTML, in order to understand the webpage elements:
- https://www.w3.org/TR/html5/dom.html#elements
- https://www.w3.org/TR/html5/dom.html#global-attributes
- https://www.w3.org/TR/html5/sec-forms.html#elementdef-input
- https://www.w3.org/TR/html5/sec-forms.html#elementdef-button
- https://www.w3.org/TR/html5/sec-forms.html#the-textarea-element
- https://www.w3.org/TR/html5/sections.html#sections
- https://www.w3.org/TR/html5/grouping-content.html#grouping-content
- https://www.w3.org/TR/html5/semantics-embedded-content.html#semantics-embedded-content
- The Test Automation University course (free course!), Corina mentioned in her session:
- Web Element Locator Strategies — with Andrew Knight
- In this course, Andrew will guide you on using Google Chrome Developer Tools to look under the hood at the HTML, CSS and JavaScript that make up web pages. Then you will learn how to write unique, robust and maintainable locators using helpful anchors from live elements. Andrew also guides you on how to use those locators in Test Automation tools and frameworks.
- Corina’s blog — I’m a Little Tester — where you can find a lot more helpful posts about testing techniques, as well as The Little Tester — comics series about Corina’s experiences with software testing
Open your free Applitools Eyes account – and see how easy it is to test your UI, automatically!