ModifyObjectProperty isn't working / doesn't save it's new property


#1

Hey Guys,

im currently fighting with the problem that the declared variable, still has the old property of the object.
Here is my code:

def new_TF22 = WebUI.modifyObjectProperty(findTestObject('blub'), 'xpath', 'equals', '//div[contains(@id, "hazardSubstance_symbols")]/ul/li/input', false)
WebUI.click(new_TF22)
WebUI.setText(new_TF22, 'GHS 01')

And here is my Console Log…

05-30-2018 11:34:36 AM - [START]  - Start action : Statement - new_TF22 = com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.modifyObjectProperty(com.kms.katalon.core.testobject.ObjectRepository.findTestObject(Blub), "xpath", "equals", "//div[contains(@id, "hazardSubstance_symbols")]/ul/li/input", false)
05-30-2018 11:34:36 AM - [INFO]   - Finding Test Object with id 'Blub'
05-30-2018 11:34:36 AM - [INFO]   - Check Test Object
05-30-2018 11:34:36 AM - [INFO]   - Check property name
05-30-2018 11:34:36 AM - [INFO]   - Cannot find property with name 'xpath' in test object 'Blub'. Creating new property with name 'xpath'
05-30-2018 11:34:36 AM - [INFO]   - Check modify value
05-30-2018 11:34:36 AM - [INFO]   - Check match condition
05-30-2018 11:34:36 AM - [PASSED] - Modify property of object successfully
05-30-2018 11:34:36 AM - [END]    - End action : Statement - new_TF22 = com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.modifyObjectProperty(com.kms.katalon.core.testobject.ObjectRepository.findTestObject(Blub), "xpath", "equals", "//div[contains(@id, "hazardSubstance_symbols")]/ul/li/input", false)
05-30-2018 11:34:36 AM - [START]  - Start action : click
05-30-2018 11:34:36 AM - [INFO]   - Checking object
05-30-2018 11:34:36 AM - [INFO]   - Checking timeout
05-30-2018 11:34:36 AM - [INFO]   - Finding web element with id: 'Blub' located by 'By.xpath: //div[contains(@id, "hazardSubstance_hazardRatings")]/ul/li/input

It doesn’t make any sense, I also tried it with “true” and “false” as condition, the issue is the same (not that you wonder, why i picked false here).

Is this a bug, or am I missing something?
Or is the xpath not right? I wrote the xpath, as if I would do it in the Object Repository.

The Log states that it’s modified succesfully and picks up the old xpath, when I work with the new set variable.

Thanks in advance for your help!


#2

I wasn’t sure if I’m actually in the right section, so feel free to move my post, if it isn’t o:)


#3

Found a different solution regarding dynamic objects…:

"Jonathan Moore said:
on further testing, I got a working code like:

TestObject dynamicObject = new TestObject('dynamicObject').addProperty('xpath', com.kms.katalon.core.testobject.ConditionType.EQUALS, newXPath, true)
WebUI.waitForElementVisible(dynamicObject, 3)

creating a new object rather than getting a TestObject from the repository and modifying it.

I
didn’t find this type of usage in the documentation, just guesswork and
hints on the forums, so it would be good to have some clarification
about which is the recommended syntax."#

https://forum.katalon.com/discussion/comment/16490/#Comment_16490


#4

Hi Guys,

Related to the modifyObjectProperty method:
When the method returns an object, should the new property value not be visible in debug viewer?
I have done this in so many ways and keep on getting the old values in the “selectorCollection” property of the “new” object

//Code, I have tried with def and without def
def to = WebUI.modifyObjectProperty(findTestObject(‘Admin/WF_AuditTrail/AuditLine’), ‘text’,
‘contains’, ‘Duplicate’, false)

In variables viewer on debug mode, i get the below as selectorCollection, which is exactly the old values:
{XPATH=//span[@id=‘form:tree:0:11:ot91’], CSS=null, BASIC=//span[(contains(text(), ‘2019-08-08 19:19:43 - “QC Check duplicates” forwarded to ACC_QC_CEN [Open Workitem] [ withdraw]’) or contains(., ‘2019-08-08 19:19:43 - “QC Check duplicates” forwarded to ACC_QC_CEN [Open Workitem] [ withdraw]’)) and @ref_element = ‘Object Repository/Admin/Admin_MainPage/Frame_Main’]}