[WebUI] Find Web Elements

Description

Find web elements by test object.

Parameters

Param Param Type Mandatory Description
to TestObject Required Represent a web element.
timeout int Required Maximum period of time (in seconds) that system will wait to return a result.
flowControl FailureHandling Optional Specify failure handling schema to determine whether the execution should be allowed to continue or stop.

Returns

The found web elements or null if cannot find any.

Example

You want to find all social networking icons on the https://katalon-demo-cura.herokuapp.com/ demo website using a test object.


import com.kms.katalon.core.testobject.ConditionType as ConditionType
import com.kms.katalon.core.util.KeywordUtil
import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.testobject.TestObject as TestObject

WebUI.openBrowser('https://katalon-demo-cura.herokuapp.com/')
// Wait for the browser to be stable
WebUI.delay(3)

TestObject testObj = findTestObject('icon_Social_networking')
List<WebElement> elements = WebUI.findWebElements(testObj, 10)
for (int i = 0;  i < elements.size(); ++i) {
	KeywordUtil.logInfo(elements.get(i).toString())
}

See also:

Feedback