How to verify 100 elements for clickability ?

Hi everyone, how can I check 100+ radio button for clickability, avoiding clicking on every element?

You should have a look at this:

I guess

  • you do not like to create 100 Test Objects
  • you do not like to write test script which looks something like:
WebUI.waitForElementPresent(findTestObject(testobject1), 10)
//do something 
WebUI.waitForElementPresent(findTestObject(testobject2), 10)
//do something 
WebUI.waitForElementPresent(findTestObject(testobject3), 10)
//do something 
WebUI.waitForElementPresent(findTestObject(testobject4), 10)
//do something 


WebUI.waitForElementPresent(findTestObject(testobject100), 10)
//do something 

Nobody would like this.

Using parameterized Test Object, your test case could be far shorter, say, 10 lines of Groovy. You would need just a few parameterized Test Objects.


I wiil try, thank you for your help

If all the radio buttons have the “type” attribute as radio, then you can collect all of them and then do a loop to confirm the button is Visible and Clickable.

Maybe like:
import org.openqa.selenium.By as By
import org.openqa.selenium.WebElement as WebElement

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

def driver = DriverFactory.getWebDriver();

'capture all the buttons associated with type of radio'
List<WebElement> radioButtons = driver.findElements(By.xpath('//input[@type="radio"]'));

maxCnt = radioButtons.size();

for (int i = 0; i < maxCnt; i++) {
	def myElement = radioButtons.get(i);
	if (!myElement.isDisplayed()) {
		WebUI.scrollToPosition(100, myElement.getLocation().getY() - 100)
	WebUI.verifyMatch(myElement.isDisplayed().toString(), "true", false)
	WebUI.verifyMatch(myElement.isEnabled().toString(), "true", false)

Edit: I added the scrollToPosition to allow the page to move down. You can comment it out or not.

1 Like