OptionTag.InnerText returns empty string...

Class library usage, coding and language questions.
lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

OptionTag.InnerText returns empty string...

Post by lyn5000 » Thu Mar 01, 2012 7:55 pm

OptionTag.InnerText returns string.Empty if InnerText contains white space at the start of the string.

Code: Select all

Ranorex.SelectTag selectTag; //I initialize this to a valid SelectTag
OptionTag optionTag; //I initialize this to a valid OptionTag from selectTag.Options
optionTag.InnerText; //returns string.Empty if InnerText start with white space.
e.g.
<option value = "6">
Blah
</option>

The actual InnerText before Blah is:
OD 0A 09 09 09 09 09 20 20 20 20 20 20 20 20 (CR LF tab tab tab tab tab space...)

But optionTag.InnerText returns nothing. I would hope it would return a string with the white space removed (so just "Blah") or the actual entire string (white space + "Blah") rather than nothing.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: OptionTag.InnerText returns empty string...

Post by Support Team » Fri Mar 02, 2012 9:36 am

Hi,

I've just tried to reproduce this issue using Ranorex v3.2.2 on IE, FF, Chrome and Safari, but was not able to.
Which version of Ranorex do you use?
Are there any other circumstances to keep in mind?

Regards,
Tobias
Ranorex Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: OptionTag.InnerText returns empty string...

Post by lyn5000 » Fri Mar 02, 2012 9:58 pm

Ranorex 3.2.1.15734. Is 3.2.2 available?
Windows 7.

Here's a narrowed-down repro page. I tried it in IE9.
All options show on the page fine but Ranorex returns nothing in the InnerText for the first three (which have white space at the start of the string; the first two options have CR LF tabs and spaces at the start and option three has CR LF at the start). Option four has no white space.

Note it DOES NOT repro if you remove the DOCTYPE XHTML 1.0 Transitional DTD tag.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<table>
<tr>
<td>selection:</td>
<td>
<select id="selectionID">

<option value = "1" selected="selected">
test1
</option>

<option value = "6">
test2
</option>
<option value = "8">
test3</option>
<option value = "10">test4</option>

</select>
</td>
</tr>
</table>

</html>

Repository2.rxrep:
DOM5=Base: /dom[@page='issueREPRO.htm']
Select7=body/table/tbody/tr/td[2]/select[@id='selectionID']

Code: Select all

Repository2 repo2 = Repository2.Instance;
SelectTag tag2 = repo2.DOM5.Select7;
IList<OptionTag> options = tag2.Options;
//The first three options have empty InnerText

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: OptionTag.InnerText returns empty string...

Post by Support Team » Mon Mar 05, 2012 9:16 am

Hi,

I've just tried out your code your web page in IE9 with Ranorex 3.2.2 but did not have any issues with executions (with and without DOCTYPE XHTML 1.0 Transitional DTD tag).

Ranorex 3.2.2 has been released last week.

Regards,
Tobias
Support Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: OptionTag.InnerText returns empty string...

Post by lyn5000 » Mon Mar 05, 2012 6:10 pm

Still repros for me after upgrading to Ranorex 3.2.2.
Attached the htm in case that helps.
Attachments
issueREPRO.zip
(382 Bytes) Downloaded 182 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: OptionTag.InnerText returns empty string...

Post by Support Team » Tue Mar 06, 2012 3:22 pm

Hi,

I'm sorry, but even with your HTML site I'm not able to reproduce the issue (with and without DOCTYPE XHTML 1.0 Transitional DTD tag).

Regards,
Tobias
Ranorex Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: OptionTag.InnerText returns empty string...

Post by lyn5000 » Tue Mar 06, 2012 8:03 pm

Attached entire Ranorex solution to show repro. The zip includes the htm as well (copy it to c:\).

Set a breakpoint after the "IList<OptionTag> options = tag.Options;" line.
Look at options; InnerText in the base class shows empty for the first three options.

Environment:
Windows 7 pro sp1 64bit.
IE9.

Someone else here also tried the solution on their machine (Windows 7 pro sp1 32bit, with IE8) and it did not repro, HOWEVER after upgrading their machine to IE9 it DID repro.
Attachments
selecttagissue.zip
(11.74 KiB) Downloaded 180 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: OptionTag.InnerText returns empty string...

Post by Support Team » Wed Mar 07, 2012 4:09 pm

Hi,
lyn5000 wrote:Someone else here also tried the solution on their machine (Windows 7 pro sp1 32bit, with IE8) and it did not repro, HOWEVER after upgrading their machine to IE9 it DID repro.
Thank you for posting us the sample solution with you html file. I tried this solution and it works as expected. Please could you try to disable the Ranorex Plugin in IE? Therefore open the manage addons dialog of IE and disable the Ranorex plug-in. Do you use the IE 64 Bit or IE32 Bit for your tests?

Regards,
Peter
Ranorex Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: OptionTag.InnerText returns empty string...

Post by lyn5000 » Wed Mar 07, 2012 7:20 pm

Using 32bit IE9. I tried with 64bit and get the same result. Debug screenshots attached.

Also tried with Ranorex add-on disabled and get the same result.

I also tried with Spy (32bit and 64bit), with and without the Ranorex addon enabled, and the issue shows in there as well. Screenshots (edited for privacy) attached; you can see the InnerText is empty for one of the options. Issue is the same whether using 32 or 64bit IE with either Spy 32 or 64bit (tried all combinations of Spy architecture and IE architecture).

Here's the Ranorex addon version in IE9:
Name: Ranorex.Plugin.TridentIpc.RanorexAddon
Publisher: Ranorex GmbH
Type: Browser Helper Object
Version: 3.2.2.16425
File date:
Date last accessed: ‎Today, ‎March ‎07, ‎2012, ‏‎4 minutes ago
Class ID: {504839B4-0C9A-4B5B-B00F-DEB2EEB870D7}
Use count: 708
Block count: 19
File: Ranorex.Libs.IeAddon3.dll
Folder: C:\Program Files (x86)\Ranorex 3.2\Bin
Attachments
screenShots.zip
(325.69 KiB) Downloaded 182 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: OptionTag.InnerText returns empty string...

Post by Support Team » Thu Mar 08, 2012 3:14 pm

Hi,

Thanks for all the files!
As there are new lines and blanks in the InnerText of your option tag, you just see white spaces in the Detail tab of Spy and with the debugger in RxStudio, because the text is on the right end of the text field, so if you delete these white spaces (in Spy) or if you click on the text field and copy the value and paste it somewhere else you will see the specific InnerText. So it is there but of course of the white spaces not in the "visible" area.

Regards,
Markus
Ranorex Support Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: OptionTag.InnerText returns empty string...

Post by lyn5000 » Thu Mar 08, 2012 6:34 pm

Thank you, that makes sense. However, the string shows in the Visual Studio debugger since it uses escape sequences to show the white space characters (screenshot attached).

So I guess the problem is with the way Ranorex displays the string in the debugger compared to Visual Studio. I noticed in Ranorex I can click on the blank area where the InnerText string value is supposed to be displayed in the debug info and click "copy value to clipboard" and then paste in notepad and the string shows up but it would be better if the string was displayed in the debugger using escape sequences like in Visual Studio.
Attachments
VisualStudioDebug.png
VisualStudioDebug.png (6.61 KiB) Viewed 2537 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: OptionTag.InnerText returns empty string...

Post by Support Team » Fri Mar 09, 2012 2:45 pm

Hi,
it would be better if the string was displayed in the debugger using escape sequences like in Visual Studio
Okay I will add a feature request and we will discuss it internally if we add this feature in one of our future releases.

Ragards,
Markus
Ranorex Support Team
.
Image