-
Notifications
You must be signed in to change notification settings - Fork 0
Selenium locators
MirekVales edited this page Mar 27, 2018
·
2 revisions
When testing with Selenium, the ability to identify a UI element you want to work with is crucial. A locator is a pattern that tells the engine which element attributes make identification possible and therefore which web elements should be processed by further commands.
Each locator starts with a locator type followed by a pattern.
css=[css selector]
Example:
css=#header
css=.button
css=tag:contains("inner text")
id=[element's id]
Example:
id=header
link=[link text]
Example:
link=DOWNLOAD
name=[element name]
Example:
name=Button1
tagname=[tag name]
Example:
tagname=input
xpath=[xpath selector]
Example:
xpath=//html/body/div
Locator behavior may be changed by an optional modifier that prefixes the actual locator.
(?[modifier])[locator body]