modifyObjectProperty doesn't take modified value

Hi all,

I have to loop and select different options in every iteration and perform some tasks. So for clicking different options in each iteration of for loop I need to modify xpath at run time so that desired option is clicked in each iteration of for loop. Below is the pic of different options need to be clicked -

However, in my code modifyObjectProperty doesn’t modify the xpath to new value in each iteration. It takes old xpath value of the option object and keeps clicking the same button in each iteration.Below is my code -
for (int i = 2; i <= 13; i++) {‘Intentwise/Overview/BiggestChanges/BiggestChangesByCampaigns/metrics_sel_dropdown’))

String xpath_val = '/html/body/div[9]/md-select-menu/md-content/md-option['+ i +']'

KeywordUtil.logInfo('xpath_val---> ' + xpath_val)

mul_metrics_opt = WebUI.modifyObjectProperty(findTestObject('Intentwise/Overview/BiggestChanges/BiggestChangesByCampaigns/metrics_mult_option'), 
    'xpath', 'equals', xpath_val, true)


Below is the logs :

Kindly help me in executing this. Any suggestions are welcome.
@kazurayam please can you help me solving this issue? Thanks in advance.

Have a look at this post first:

I did not know WebUI.ModifyObjectProperty() keyword. I have never used it.

The previous discussion “modifyObjectProperty” tells me that ModifyObjectProperty() might be buggy. Possibly you should not use it.

And in the post Jonathan_Moore suggested an alternative approach of creating instances Test Object dynamically. I have ever tried the same and was successful.


Could you bring this topic into the Bug report category?

@kazurayam This method worked for me . Thanks alot !