I know Katalon Studio v10.2 and newer uses Selenium v4.28.1. I checked the source code of Katalon Studio v10.3.1 and found the WebUI.getAttribute(TestObject,String) keyword is not using driver.getDomAttribute and driver.getDomProperty methods at all. I got a question: does the WebUI.getAttribute() keyword work in Katlaon Studio v10.3.1?
In the javadoc of Selenium v4.28.1,
I wrote the following Test Case script, and ran it using Katalon Studio v10.3.1. The editor stroke out the call to getAttribute. But when I ran the script, I ran fine. So I understand that the getAttribute method is depreceted but not yet removed; so it is still usable in the Selenium v4.28.1 in the Katalon studio v10.3.1.
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.webui.driver.DriverFactory
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.By
import internal.GlobalVariable as GlobalVariable
TestObject makeTestObject(String id, String xpath) {
TestObject tObj = new TestObject(id)
tObj.addProperty("xpath", ConditionType.EQUALS, xpath)
return tObj
}
WebUI.openBrowser(GlobalVariable.G_SiteURL)
WebUI.callTestCase(findTestCase('Common Test Cases/Login'),
[('Username') : 'John Doe', ('Password') : 'ThisIsNotAPassword'],
FailureHandling.STOP_ON_FAILURE)
TestObject hospitalReadmission =
makeTestObject("check_hospital_readmission",
"//input[@name='hospital_readmission']")
WebUI.verifyElementPresent(hospitalReadmission, 10)
/*
String value = WebUI.getAttribute(hospitalReadmission, "value")
assert value == "Yes"
*/
WebDriver driver = DriverFactory.getWebDriver()
WebElement webElement = driver.findElement(By.xpath("//input[@name='hospital_readmission']"))
String v = webElement.getAttribute("value") // Stroke out!
assert v == "Yes"
WebUI.closeBrowser()
“no longer function” — I do not see what @josh.meeks meant.
I think, WebElement.getAttribute() still works in Katalon Studio v10.3.1

