Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
XPath and CSS Locators for Test Automation
Highest Rated
Rating: 4.6 out of 5(4,939 ratings)
16,238 students

XPath and CSS Locators for Test Automation

Build stable XPath and CSS selectors using DevTools for Selenium, Playwright, and modern web apps
Created byDmitry Shyshkin
Last updated 1/2026
English

What you'll learn

  • Build stable and readable XPath and CSS locators for test automation
  • Locate complex and dynamic web elements using advanced XPath techniques
  • Write clean CSS selectors and understand when to use CSS vs XPath
  • Debug, fix, and improve broken or flaky locators using Chrome DevTools

Course content

9 sections48 lectures4h 43m total length
  • Stop Fighting Locators: Course Overview3:36

    Create an engaging start that focuses on students’ pains and outcomes first, then briefly introduce yourself and the course structure

  • How to Learn Locators Effectively4:17

    Give concrete, practical instructions on how to follow the course, practice effectively, and use support/resources

Requirements

  • Basic understanding of HTML and how web pages work
  • Some experience with UI test automation tools like Selenium or Playwright
  • No advanced programming knowledge required; all locator concepts are explained step by step

Description

XPath and CSS locators are the core skills behind reliable UI test automation. Flaky tests, unstable selectors, and “element not found” errors almost always come from poor locator strategy.

In this course, you’ll learn how to build stable XPath and CSS locators for real web applications using Chrome DevTools. The focus is practical: how to read the DOM, understand element relationships, and create selectors that work in Selenium, Playwright, and modern automation frameworks.

You’ll start with locator fundamentals and quickly move into real XPath and CSS patterns used in production test automation:

  • XPath syntax, predicates, and relative paths

  • XPath functions like text(), contains(), starts-with(), and not()

  • XPath axes for locating elements relative to other elements

  • CSS selectors, attribute matching, combinators, and pseudo-classes

  • XPath vs CSS: when to use each and why

  • Debugging and fixing broken locators in DevTools

This course avoids auto-generated selectors and teaches you how to design clean, readable, and maintainable locators that survive UI changes. Every XPath and CSS selector is tested directly in the browser before being used in automation.

Who this course is for:

  • QA engineers, SDETs, and test automation engineers

  • Selenium and Playwright users

  • Developers writing or reviewing UI tests

  • Anyone struggling with flaky tests caused by bad locators

By the end of the course, you’ll be able to read any DOM, choose the right locator strategy, and write reliable XPath and CSS selectors with confidence.

Who this course is for:

  • QA engineers, SDETs, and test automation engineers working with Selenium or Playwright
  • Developers who write or review UI tests and want more reliable XPath and CSS locators
  • Anyone struggling with flaky UI tests caused by unstable or auto-generated selectors