# semantic-locators
**Repository Path**: mirrors_google/semantic-locators
## Basic Information
- **Project Name**: semantic-locators
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-01-19
- **Last Updated**: 2026-03-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Semantic Locators

Semantic Locators let you specify HTML elements in code similar to how you might
describe them to a human. For example, a create button might have a semantic
locator of `{button 'Create'}`.
Semantic Locators are stable, readable, enforce accessibility, and can be
auto-generated.
Just want to get started writing semantic locators? See the
[tutorial](docs/tutorial.md), or read on for an introduction.
## Getting started
See the getting started instructions for your environment:
* [JavaScript/TypeScript in the browser](javascript/README.md)
* [Java WebDriver](webdriver_java/README.md)
* [Python WebDriver](webdriver_python/README.md)
* [.NET WebDriver](webdriver_dotnet/README.md)
* Something else? Adding support for a new platform is simple. See
[DEVELOPING.md](docs/DEVELOPING.md) for instructions.
## Examples
HTML | Semantic Locator
-------------------------------------------------- | --------------------------
`` | `{button 'OK'}`
`
` | `{tab 'Meeting'}`
`
` | `{list} {listitem}`
`` | `{button 'User id: *'}`
`` | `{checkbox checked:false}`
## Why Semantic Locators?
As the name suggests, Semantic Locators find elements based on their
**semantics**. This has a number of benefits over other types of locators.
### Semantics
First we should define the term "semantics".
The semantics of an element describe its meaning to a user. Is it a button or a
checkbox? Will it submit or cancel an operation? When using assistive
technologies like screen readers, the semantics of an element determine how it
is described to users.
There are many semantically equivalent ways to implement OK buttons. The
following elements are all matched by the semantic locator `{button 'OK'}`.
```html
OK
OK
```
To be precise, `button` refers to the
**[ARIA role](https://www.w3.org/TR/wai-aria/#usage_intro)** expressed by the
element. `'OK'` refers to the
**[accessible name](https://www.w3.org/TR/accname/#dfn-accessible-name)** of the
element.
What benefits does finding elements by their semantics provide?
### Stability
Semantic locators are less brittle to user-invisible changes. Matching semantics
abstracts away implementation details. For example if
```html