Locator Type Constants

class mops.mixins.objects.locator_type.LocatorType[source]

A container for locator types.

This class standardizes the locator types used in the Mops framework, ensuring consistency and clarity when locating elements within web pages.

Note

You can specify a locator type along with your locator using the following syntax:

  • Element('xpath=//*[@class="class-name"]')

  • Element('css=[class *= class-name]')

  • Element('text=some text with spaces')

  • Element('id=id-without-spaces')

The same applies to the Locator object:

  • Element(Locator(ios='xpath=//*[@class, "ios-specific"]'))

Note

For better readability, you can use this class with the following syntax:

  • Element(f'{LocatorType.XPATH}=//*[@class="class-name"]')

CSS: str = 'css'
XPATH: str = 'xpath'
ID: str = 'id'
TEXT: str = 'text'