XPath doesn't detect text with & nbsp; as spaces

Showing 1-7 of 7 messages
XPath doesn't detect text with & nbsp; as spaces Johanan 4/20/12 2:34 AM
I've experienced a problem that is discribed here:

http://groups.google.com/group/selenium-users/browse_thread/thread/65c11c28b44dddee/e997e0df98eb85c8?lnk=gst&q=XPath+unable+to+detect+text+with+%26+nbsp%3B+as+spaces#e997e0df98eb85c8

Exactly, if some text on my site starts with   symbol I cannot
locate it properly.
Using "\u00a0" doesn't help either.
Re: [selenium-users] XPath doesn't detect text with & nbsp; as spaces Shaba 4/20/12 2:59 AM
Can't you use the contains() function ?? for a string within the text 


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


Re: XPath doesn't detect text with & nbsp; as spaces Johanan 4/20/12 3:29 AM
In the most cases  -yes, I can but still I need use starts-
with(text(), 'filter') when I am testing filtering.
RE: [selenium-users] Re: XPath doesn't detect text with & nbsp; as spaces Mark Collin 4/20/12 4:03 AM
I think you could use some advanced XPath to convert   into a space,
have a look at the following to point you in the right direction:

http://stackoverflow.com/questions/1852571/xpath-function-to-remove-white-sp
ace

--


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


Re: XPath doesn't detect text with & nbsp; as spaces Johanan 4/20/12 5:23 AM
Thank you for the answer but

//*[starts-with(translate(text(), "\u0160", ''), 'filter')]
//*[starts-with(translate(text(), "\u00a0", ''), 'filter')]
//*[starts-with(translate(text(), "&nbsp", ''), 'filter')]
//*[starts-with(translate(text(), " ", ''), 'filter')]

all these variants do not work. Maybe I am to represent the &nbsp
symbol in &#12 format but I cannot find how to do it.

On 20 апр, 15:03, "Mark Collin" <mark.col...@lazeryattack.com> wrote:
> I think you could use some advanced XPath to convert &nbsp; into a space,
> have a look at the following to point you in the right direction:
>
> http://stackoverflow.com/questions/1852571/xpath-function-to-remove-w...
Re: [selenium-users] Re: XPath doesn't detect text with & nbsp; as spaces Shaba 4/20/12 6:20 AM
@Mark,

Thanks for sharing that conversation.
That's helpful

Cheers,
Shabana
Re: XPath doesn't detect text with & nbsp; as spaces Johanan 5/13/12 10:26 PM
We have found the solution:

//*[starts-with(translate(text(), ' ', ''), 'filter')]

this line works! Notice: the 2nd argument in translate() function is
nbsp inserted with Alt+0160