How to handle   (whitespace)

2,530 views
Skip to first unread message

Sathish Kumar Sathyamoorthy

unread,
Jun 8, 2011, 6:56:05 AM6/8/11
to robotframework-users, Radhika...@symphonysv.com
Dear All,
Hope doing great. I have one issue.

I have to select an option from the combobox whose html is as follows;

In Firefox browser;
<select id="ctl00_ContentPlaceHolder1_Filters1_TIMELEVEL_IND"
name="ctl00$ContentPlaceHolder1$Filters1$TIMELEVEL_IND">
<option value="W" selected="selected">Current&nbsp;Week</option>
<option value="P">Current&nbsp;Period</option>

In IE8.0 browser;
<SELECT id=ctl00_ContentPlaceHolder1_Filters1_TIMELEVEL_IND
name=ctl00$ContentPlaceHolder1$Filters1$TIMELEVEL_IND> <OPTION
selected value=W>Current&nbsp;Week</OPTION> <OPTION
value=P>Current&nbsp;Period</OPTION></SELECT>

The options are
Current Week
Current Period

but the log file is displaying the following error message;

FAIL ERROR: Option with label 'Current Period' not found

Query: how to pass this option to the combobox for selection in the
RobotFramework?

tmpalaniselvam

unread,
Jun 16, 2011, 7:35:34 AM6/16/11
to robotframework-users
Satish,
Can you post the solution, if you have?

Thanks,
Palani

Pekka Klärck

unread,
Jun 19, 2011, 3:58:35 PM6/19/11
to sooriyan...@gmail.com, robotframework-users, Radhika...@symphonysv.com
2011/6/8 Sathish Kumar Sathyamoorthy <sooriyan...@gmail.com>:

This depends fully on the library you use and the tool that the
library uses. I assume you are using SeleniumLibrary which uses
Selenium. An easy way to test how Selenium works is installing
Selenium IDE and using it to record the action. If it can record and
re run the test, you can then see what it captured and use the same
arguments with SeleniumLibrary's keywords.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Sajjad Malang

unread,
Jun 20, 2011, 2:35:08 AM6/20/11
to sooriyan...@gmail.com, Radhika...@symphonysv.com, robotframework-users
Hello,
I read that seleneese you should be able to use the special variable ${nbsp} to match the &nbsp; alternatively you can also try to input a hard-coded non-breaking space (U+00A0) by typing Alt+0160 on Windows between the two quotes.

Do let me know if one of the two solutions above work.

Regards,
\Sajjad.


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframe...@googlegroups.com.
To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.




--
Regards,
\Sajjad.

http://www.babycareindia.com

Pekka Klärck

unread,
Jun 20, 2011, 2:56:57 AM6/20/11
to sajjad...@gmail.com, sooriyan...@gmail.com, Radhika...@symphonysv.com, robotframework-users
2011/6/20 Sajjad Malang <sajjad...@gmail.com>:

> Hello,
> I read that seleneese you should be able to use the special variable ${nbsp}
> to match the &nbsp; alternatively you can also try to input a hard-coded
> non-breaking space (U+00A0) by typing Alt+0160 on Windows between the two
> quotes.

I don't know does Selenium RC understand Seleneese or not. If it does,
then the special variable ought to work. You need to escape it like
\${nbsp} in Robot's test data, though, because otherwise Robot will
try to resolve it.

Sathish Kumar Sathyamoorthy

unread,
Jun 29, 2011, 5:32:27 AM6/29/11
to robotframework-users
Dear All,
Solution or Work around which i did is as follows;

1) Read the list values using the keyword "Get List Items" and put it
in an array (list).

2) Pass the first element of this array to a python function to get
the ASCII code of the character "&nbsp;" in the option
"Current&nbsp;Period" (using the following python code)

# Get the ASCII value for each character in a string
def getASCIIValue(str5):
Avalue=[]
x = 0
for i in range(0, (len(str5))):
x = ord(str5[i])
Avalue.append(x)

return Avalue

2) ASCII code for the character "&nbsp;" "\xa0" is 160

3) Then i used chr(160) in the PythonWin to know the character.
>>> chr(160)
'\xa0'

From here i came to know that the the Here RoboFramework is reading
the "&nbsp;" as "\xa0"

4) Then i had created the following python script to write this
character in a text file whose Encoding type is UTF-8 (Create and save
the text file by setting the option Encoding = UTF-8).

# Write the string to a file

def WriteFile(str6):
filename = "D:\\EYC\\RobotFramework\\Aspects\\RSC_TestSuite\
\Data_Resource_Files\\OutputFile.txt"

# Create a file object:
# in "write" mode
FILE = open(filename,"a")
FILE.write(str6)
FILE.close()

WriteFile("Current\xa0Period")

This function written the following text in the OutputFile.txt whose
Encoding type is UTF-8;

Current Period

Then i copied this line and put it in the RIDE as the option to
select.

Thanks & regards,
Sathish

On Jun 8, 3:56 pm, Sathish Kumar Sathyamoorthy
Reply all
Reply to author
Forward
0 new messages