[WebUI] Find Web Element

Description

Find web element 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 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())

See also:

Feedback