Div don't use the symbolic :text for dom matching (locating) which is what 
you're trying to do. with the failing syntax.
Divs use :name :id :index


 



On Wednesday, November 5, 2014 3:36:23 PM UTC-6, Andrew Le wrote:
>
> In Ruby, I'm trying to scrape a page's visible text, save it to a 
> database, and be able to reference the containing element later on. The 
> problem is that all the text methods return formatted text and collapse 
> tags that no longer match the markup. Consider the following example:
>
> <div id="el_id">
>   one
>   <span>two</span>
>   <span>three</span>
> </div>
>
> OR
>
> <div id="el_id">one&nbsp;two three</div>
>
> Getting text from visible element:
> element = browser.div(:id, "el_id")
> element.text will return "one two three"
>
> Trying to reference element later:
> browser.element(:text, "one two three") will not return a result
>
> ** The target element may not have an ID or class at all, which is why I'm 
> trying to locate by text.*
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to