Problem with " " and Element.InnerText

Ask general questions here.
Posts: 2
Joined: Mon Sep 13, 2010 9:59 am

Problem with " " and Element.InnerText

Post by bbarbisch » Mon Sep 13, 2010 11:16 am


I've a problem with comparing the value of a web element (retrieved by Element.InnerText) with a given String. The value of the web element contains a " " element instead of a normal space character.
After comparing the ascii codes of the read value and the given String I found that the code for the space char is incorrect for the read value (63 instead of 32).

Is there a problem with the reading of " " elements? Maybe a bug?

OS: WinXP Pro SP3
Ranorex 2.3.4

Test Setup:
- The element is part of a dynamically created list of links (therefore I can't simply use the ID tag, i need to iterate through the elements and compare their names to find the correct element)
- attachements (zipped in
-- a simplified demo test page is attached
-- a little demo test file (sourcecode, written in C#) is attached (it already contains the Main method and the test repository so it just needs to be compiled and executed)
- demo execution notes
-- open the html file in a browser, compile/start the demo app, select the browser again (there is a pause about 5 secs right at the beginning of the execution to allow one to give the focus to the browser)
-- ascii codes are logged in the test report file so it might be interesting for you to check them.
(2.01 KiB) Downloaded 184 times

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

Re: Problem with " " and Element.InnerText

Post by Support Team » Mon Sep 13, 2010 12:57 pm


No this is no bug. It depends on the ASCII table. You get the 63 code, because ASCII don't know the characters and code 63 means "?". Please change the table from ASCII to UTF8 and you will see that this character is recognized as " ".

Ranorex Team