Page 1 of 1

Chrome interprets innertext other than IE

Posted: Thu May 22, 2014 2:46 pm
by C-PT
Hi there,

I'm using Ranorex 5.0.3 on a 64bit Win7 machine with up-to-date Windows Updates. While testing with Internet Explorer 11.0.9600.17107 and Chrome 34.0.1847.137 m.
During the tests I tried to run a TestCase in IE, which I had written in Chrome. Everything was executed without errors, except for a verification on an empty innertext element. I discovered that Ranorex or IE seems to handle innertext a bit different to Chrome.

Have a look at the two Ranorex Spy screenshots, which show the element in question.

Internet Explorer:
InnerTextIE.PNG
Chrome:
InnerTextChrome.PNG
As you can see, Spy greys out the IE innertext other than the Chrome innertext. This is causing the running failure and is making my automation work a bit messy.
Note: If I fill in a character or more characters, IE and Chrome do detect them equally correct. The problem just arises when there is no character between the DIV tags.

Thank you for any help!

Greetings from Salzburg.

Re: Chrome interprets innertext other than IE

Posted: Fri May 23, 2014 1:58 pm
by krstcs
The level of grey denotes the weight that Ranorex has assigned to the attribute for the object identification algorithm. The darker the color, the more likely that Ranorex will use that attribute, if it has a value, to identify the element. An InnerText attribute is typically not going to be used unless absolutely necessary because, depending on the object, it could be changed at runtime, but a user. Ranorex favors attributes that are not likely to change (such as id, class, name, automationid, automationname, etc.).


Both Chrome and IE should have an InnerText attribute (all HTML has an InnerText at all times, even if it is null). Have you checked in your test to see what the value of the attribute is?

Code: Select all

Report.Debug("USER", "Value of InnerText=" + repo.<your object and parents>.InnerText);

Re: Chrome interprets innertext other than IE

Posted: Mon May 26, 2014 10:27 am
by C-PT
Hi krstcs,

thanks for your reply! During some attempts to fix the problem for me, I found out, that:
For Chrome, the empty innertext element is a zero symbols long string, while for IE, it is <null>.

I don't know if this difference is caused by Ranorex or by the browsers itself.

A very simple solution

Code: Select all

if((repo.<PathToElement>.InnerText == "") || (repo.<PathToElement>.InnerText == null))
Greetings from Austria

Re: Chrome interprets innertext other than IE

Posted: Tue May 27, 2014 2:17 pm
by krstcs
Yeah, I don't know if it is Chrome/IE or Ranorex, but I would guess Ranorex. If it is possible, Ranorex should be presenting them all the same way, which I think is the problem here.