Skip to main content

[WebUI] Find Web Element

Description

Find web element by test object.

Parameters

ParamParam TypeMandatoryDescription
toTestObjectRequiredRepresent a web element.
timeoutintRequiredMaximum period of time (in seconds) that system will wait to return a result.
flowControlFailureHandlingOptionalSpecify failure handling schema to determine whether the execution should be allowed to continue or stop.

Returns

The found web element or null if cannot find any.

Example

You want to find the Facebook icon 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 until the brower's stable
WebUI.delay(3)

// Create a test object. This is the Facebook icon on the demo website
TestObject testObj = findTestObject('icon_Facebook')
WebElement anElement = WebUI.findWebElement(testObj, 5)
KeywordUtil.logInfo(anElement.toString())