Unable to perform button click operation

When i run the script recorded through record and play back method for my login page, the button click operation for login can’t be performed, it displays the error “Unable to click on object ‘Object Repository/temp1/Page_FreightRover - Login/input_btn btn-success btn-lg c’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/temp1/Page_FreightRover - Login/input_btn btn-success btn-lg c’ located by ‘By.xpath: //input[count(. | id(“isMember”)/div[@class=“form-item form-item-on-top form-horizontal”]/div[@class=“form-group”]/div[@class=“row”]/div[@class=“col-sm-6 col-xs-6”]/input[@class=“btn btn-success btn-lg col-xs-12 signin_icon”]) = count(id(“isMember”)/div[@class=“form-item form-item-on-top form-horizontal”]/div[@class=“form-group”]/div[@class=“row”]/div[@class=“col-sm-6 col-xs-6”]/input[@class=“btn btn-success btn-lg col-xs-12 signin_icon”])]’ not found)”. I also tried capturing that with object spy method also, but it displays the error “groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText() is applicable for argument types: (java.lang.String, java.lang.String, com.kms.katalon.core.model.FailureHandling) values:”

Hey Raj,

Did you end up getting anywhere with this?

I am coming across the same issues with my tests.

Appreciate the help.

Thanks,

Phoebe

Hi Raj,

Please go to developer tool in chrome and try to copy the xpath for the button which you want to click. update copied xpath for that button and then run the script.

Hi duyluong,

Still it is failing on that same step… i don’t face any issue while entering the values in the text field. It becomes unresponsive on that button click step…

This is the line of code where i am getting that error:

WebUI.click(findTestObject(‘my element id goes by here’),10)

I deselected the other locators and selected xpath alone, added the wait property and tried, still it shows the same error.

“groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText() is applicable for argument types: (java.lang.String, java.lang.String, com.kms.katalon.core.model.FailureHandling) values:”

Could you deselect few locators from Object properties. Try using one locator such as Xpath.
Before that, could you add wait before click method

Hi Raj,

Please check your script again, the script if you use setTextkeyword should be:

WebUI.setText(findTestObject('test_object_id'), 'text', FailureHandling.STOP_ON_FAILURE)

Thanks.

image.png

1 Like

Balraj Alladi said:

Perfect solution!

I am not able to compile below Keyword in Katalon. Any suggestions please…

package com.utilities

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.WebDriver

import org.openqa.selenium.WebElement

import com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor

import com.kms.katalon.core.annotation.Keyword

import com.kms.katalon.core.checkpoint.Checkpoint

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import com.kms.katalon.core.model.FailureHandling

import com.kms.katalon.core.testcase.TestCase

import com.kms.katalon.core.testdata.TestData

import com.kms.katalon.core.testobject.TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.driver.DriverFactory

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

import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium

import org.openqa.selenium

import internal.GlobalVariable

@Keyword

def clickUsingJS(TestObject to, int timeout)

{

WebDriver driver = DriverFactory.getWebDriver()

WebElement element = WebUICommonHelper.findWebElement(to, timeout)

JavaScriptExecutor executor = ((driver)as JavaScriptExecutor)

executor.executeScript(‘arguments[0].click()’,element)

}

What is the error?

I am getting below message when hoovering mouse on WebUICommonHelper -
WebObject WebUICommonHelper - com.utilities.cfunction.clickUsingJS(TestObject, int)

I suggest you read this entire thread carefully then try to implement the code as written properly. If you get an error, create a NEW, SEPARATE topic and follow ALL the advice I gave here:

1 Like

Thank you Russ, Will do as suggested