Sunday, September 5, 2010

Locator for cell containing nbsp in Selenium RC

If you want to point to a table cell containing a   (non breaking space) character then you must use the unicode equivalent of nbsp i.e \u00a0 in your locator. Interestingly this is required only in Selenium RC. A simple space would suffice if you were to achieve this in Selenium IDE. Below is the sample HTML code that has the table with the cell containing the nbsp and the selenium RC instruction to highlight that cell.

<table border="1">
<tr>
<td>abcd&nbsp;efgh</td>
<td>abcdefgh</td>
</tr></table>



selenium.highlight("//td[text()='abcd\u00a0efgh']");

5 Comments:

SHANMUGAVEL.C said...

Hi Mahesh,

I am using selenium RC with Visual Studio 2010 IDE and created tests.
Here i am facing a problem in identifying dynamic objects.
Object id looks like "ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl12_AreaNameFooterTextBox"
Here ctl12 is the part which is changing based on which row...But i want to enter the value irrespective of row position..

I tried many things but no luck.. Here are the details...

//*[@id='ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl12_AreaNameFooterTextBox'] works fine in Selenium IDE when I click FIND button in IDE.
But below are not working in selenium IDE when I click FIND.
(1)
//input[Contains(@id,'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl') and Contains(@id,'_AreaNameFooterTextBox')]
(2)
//input[@id,RegExp:'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl??_AreaNameFooterTextBox']
(3)
//input[@id,glob:'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl*_AreaNameFooterTextBox']
(4)
//*[@id,glob:'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl*_AreaNameFooterTextBox']


Can u help me on this... How can I identify this object? Can u give me your mail id to contact u on this problem and further for selenium automation....

Thx in advance....
SCSVEL
scsvel@gmail.com

cameron said...

thanks for the run though of you pocess, it was much needed. another point of view for this cheers www.globalkap.com

David said...

Read all the related Posts:

64 Software Manual Testing Interview Questions

Answers To Common Job Interview Questions

Behavioral Questions In Interviews

Questions to Ask at an Interview

Competency based Interview Questions


Read all the related Posts:

How to avoid missing defect in Software Testing?

Defect Management Process

What is the difference between a Test Strategy and Test Plan?

Beginners Guide to ETL Testing

Step by step guide from Test Case Development to Test Execution

Yasa said...

Hello,

i am representing www.mrosupply.com - industrial goods ecommerce store, extension of a family owned 114 year old business selling motors, electrical components, conveyor belting and related products. In this, we are looking for opportunities to buy inexpensive links from various blogs, websites, etc.. We would like to get a small tiny link on your website, on the homepage preferably. How much would that cost?

Thank you in advance.
Regards,
Yanina Dani
email: kievforyou@gmail.com

Baldor Single Phase motors

Nicole Curtis said...

Automated testing is critical to cost-effectively developing and deploying quality software applications on time. What is Application Packaging