Page 1 of 1

Setting attribute 'text' failed on element

Posted: Fri Nov 06, 2015 1:36 pm
by Oksana
Hi!

Can you provide me any help with solving such issue?

When I try to set some value for iOS text element (manually from Ranorex Spy tool; from code using .TextValue property; from code using .Element.SetAttributeValue("Text", "")) occurs exception (or appears 'Properties Window' in the Spy, see attached image) saying 'Setting attribute 'text' failed on element ...'

This error can be reproduced also in the 'ranorex.RxBrowser' app (text element for url), but not in the 'ranorex.MiniKeePass'.
Devices with iOS 9.1 and 8.4.1 .
Ranorex 5.4.3 (there is no such issue for 5.4.2, but I can't go back to older version, since it doesn't support iOS 9)
RxServiceApp 2.1.0

Regards,
Oksana

Re: Setting attribute 'text' failed on element

Posted: Mon Nov 09, 2015 5:06 pm
by tvu
We are facing the same issue. It happens to us about 25% of the time. We sent Support an IPA of my app to troubleshoot, but they haven't given us a solution yet. In the meantime, we wrote some code to type in the string using the PressKeys() method.

Additionally, when setting the text value did work we were facing the issue where setting the value sometimes sends the "Enter" key at the end of the string and sometimes it doesn't. We had to add some logic to handle that scenario.

Re: Setting attribute 'text' failed on element

Posted: Mon Nov 09, 2015 6:58 pm
by Otter_T
I believe this is the same issue I'm having, and it seems to have started with 5.4.3. Running test on iPad with iOS 8. Rxlog says:

Setting attribute 'Text' failed on element '{Text:userId}'.
-[__NSCFString replaceCharactersInRange:withString:]: Range or index out of bounds

It's not an object recognition issue, because after the test fails, I can do a "Highlight Element" and Ranorex finds/highlights the element immediately.

Re: Setting attribute 'text' failed on element

Posted: Fri Nov 13, 2015 10:28 pm
by Support Team
Hello All,

Thank you for bring this up to our attention. We have been able to reproduce this issue and are diligently working on creating a fix for this.

It appears as if this is caused by instrumenting the application via the instrumentation wizard.

Furthermore, as a workaround for the meantime you could instrument the application through Source-Code.