Different behavior in Windows 7 and Windows 10

Hi all,

We’re having problems when running our automated tests in Windows 10 (Chrome Browser). This is working flawlessly in both Windows 7 and Ubuntu, but same code is failing in Windows 10, for example:

def var = WebUI.getText(findTestObject('element_link'))

This is correctly retrieving text value from an input field in W7. In W10 it’s retrieving an empty string ("").

It’s the same when using:

WebUI.verifyElementText(findTestObject('element_link'), 'value')

In W10 it’s always failing because it’s comparing the desired value with an empty string.

Our web application is built in AngularJS, and maybe it’s related to that, but I can’t realize why it’s different depending on the OS version. I’ve searched for this problem in this forum and in the Internet, but I have not been able to find anyone who has the same problem…

Our environment:

Katalon version: 5.6.0
Chrome version: 68.0.3440.106 (Build oficial) (64 bits)

Thanks in advance.

Perhaps Blink runs a little slower on Win10?

Did you make sure the element_link is visible before trying to access it?

Russ Thomas said:

Perhaps Blink runs a little slower on Win10?

Did you make sure the element_link is visible before trying to access it?

Yes, in fact we’ve been debugging the test case, step by step, and the result is the same even when trying to retrieve the value from the field a lot of time after it has loaded.

Can you post the relevant HTML here?

1 Like

Of course:

<input id="buyer_auto_complete_input"
class="mdl-textfield__input ng-pristine ng-valid ng-not-empty ng-touched" autocomplete="off"
data-ng-readonly="autoComplete.evaluateReadonly()" data-ng-disabled="!autoComplete.editable"
data-ng-model="autoComplete.valueDisplay" data-ng-change="autoComplete.updateFilter()"
data-ng-focus="autoComplete.showDropDown($event)"
data-ng-blur="autoComplete.allowNewValuesEnabled ? autoComplete.clickOptionHandler(autoComplete.valueDisplay) : false"
readonly="readOnly" style="">

I’ve included line breaks for easy reading.

It corresponds to this field:

As you can see, the html code itself doesn’t contain the value for this field (highlighted), and the available options are only present in the html code when you open the dropdown field. Once you select one, they also disappear from the code.

This could be related with the problem, as I said it’s AngularJS and could be the origin of the problem, but:

- In W7 it works, when you use “WebUI.getText” it retrieves the value selected.
- In W10 it doesn’t work, but you have a workaround using “WebUI.getAttribute(findTestObject(‘element_link’), ‘value’))”. This way it’s retrieving the value correctly.

We could change our approach and replace every getText(to) for getAttribute(to, value), and every verifyElementText(to, value) for verifyMatch(getAttribute(to, old_value), new_value), and even include them in custom keywords. But I suspect that these won’t be the only needed changes… Also, I would prefer a consistent behavior in W7/W10 directly using the out-of-the-box functions from Katalon.

Buyer.png

Thanks for the extra, detailed info.

We could change our approach and replace every getText(to) for _getAttribute(to, value)
_

You should. Now it’s clear to me what’s going on. The documentation for Get Text is as follows:

Get the visible (i.e. not hidden by
CSS) inner text of the web element, including sub-elements, without any
leading or trailing whitespace.

Said another way, this API retrieves the text inside an element, i.e. between the opening tag and the closing tag.

  • This Stuff Here

The value property and the value attribute of an input element are not the inner text.

But, you say, it works on Win7!

I have no explanation for that. Sorry.

1 Like

That makes sense, maybe the strange behavior is in Win7.

We’ve started changing every getText for getAttribute, and for now it’s working correctly. Hopefully we’ll just need to change that method for getting everything fine in every OS.

Thanks again for your help!

Cool. Glad it’s working now.