Selection Methods for Web Tests

Katalon Studio allows you to choose different strategies to locate WebUI objects.

To set the default selection method used in Spy/Recorder of a project:

  • From 7.6 onwards: Go to Project/Settings/Self-healing/Web UI/Test Design
  • From 7.6 backward: Go to Project/Settings/Test Design/Web Locators

Regarding XPath, you can additionally set the priority of XPath locators while with Attributes, you can decide which object properties to be used for recognizing objects.

You're allowed to override the global settings above in a specific object. Open an object's view, configure a selection method used for this object particularly.

Switch Selection Method in an object's view

In an object's view, you can freely switch from one selection method to another. The detailed content of each selection method is saved automatically.

In an object's view, you can:

  • Choose an object locating strategy among XPath, Attributes, CSS or Image
  • Check only preferred properties of an object
  • Input a desired XPath or CSS locator in the Selector Editor manually


Katalon Studio supports Smart XPath (a.k.a Relative XPath) for better object recognition. If an element cannot be consistently located using its direct attributes, Katalon Studio identifies the element by using its more robust neighbors. This method is visually intuitive as it reflects the way users often identify a visible element on the user interface.

Learn more about how Katalon generates Smart XPaths

If XPath is set as the default selection method when spying and recording, Katalon Studio generates a list of Smart XPaths automatically.

Learn more about how Katalon detects objects with XPath


A test object is typically built up by several properties. During test execution, Katalon Studio uses them to detect an object.

If Attributes is set as the default selection method during spying and recording, Katalon Studio generates XPath locator automatically that combines all the selected object properties to locate that object. Again, you can check/uncheck preferred properties in the Object's Properties table.


Those who wish to input their CSS locator of a test object manually can select the CSS option. Open an object's view and enter a CSS locator value in Selector Editor.

Change the CSS selector of an object at runtime

To change a Test Object's CSS value at runtime, you can use the following code snippet:

import com.kms.katalon.core.testobject.SelectorMethod

TestObject to = findTestObject('your_test_object_id')

//Change value of CSS selector
to.setSelectorValue(SelectorMethod.CSS, 'your_desired_value')

//Change selection method from another selector to CSS selector

See also:


From 7.2.2 onwards, Katalon supports visual object recognition. You can learn more about how to create image property for an object

See also