Skip to main content

[WebUI] Verify Element Not Has Attribute

Description

Verify if the web element doesn't have an attribute with the specified name.

Keyword name: verifyElementNotHasAttribute

Parameters

ParameterParameter TypeRequiredDescription
toTestObjectYesRepresents a web element.
attributeNameStringYesThe name of the attribute to verify.
timeoutintYesSystem will wait at most timeout (seconds) to return result
flowControlFailureHandlingOptionalSpecify failure handling schema to determine whether the execution should be allowed to continue or stop.

Returns

Parameter TypeDescription
Boolean
  • true if the element doesn't have the attribute with the specified name.
  • false if the element has the attribute with the specified name

Example

You want to verify the Make Appointment button doesn't have attribute href:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable

'Open browser and navigate to demo AUT site.'
WebUI.openBrowser(GlobalVariable.G_SiteURL)

'Verify \'Make Appointment\' button doesn\'t have attribute \'href\''
WebUI.verifyElementNotHasAttribute(findTestObject('Page_CuraHomepage/btn_MakeAppointment'),'href', 20)

'Close browser'
WebUI.closeBrowser()
Was this page helpful?