Give this a try. From your description it sounds like you're looking for
the text and not the value. You might also be running into a timing issue
here.
puts @browser.span(:id => "*lblTitleHolder*").when_present.text
On Friday, December 26, 2014 5:29:52 PM UTC-5, Ma St wrote:
>
> I am attempting to figure out how to capture an element's text value (ex.
> span id text value = "Welcome"), but I keep getting an error that it is
> unable to locate the value. The following is my statement in the ruby
> file. I tried online forums and documentation, but the syntax seems
> tricky. Is there something about the syntax that is off? I can report on
> the URL, so I know it sees my webpage. I tried specifying the span id as a
> tag, but that does not work either.
>
> *.rb file*
> mark = @browser.div(:id => "content-holder")
> p mark
>
> *Error:*
> #<Watir::Div:0x..fdb100fc2 located=false selector={:id=>"content-holder",
> :tag_name=>"div
> "}>
>
> *HTML:*
> <div id="content-holder" class="content-holder">
> <br>
> <div class="SiteBreadCrumb"> </div>
> <div style="height: 8px;"> </div>
> <table width="910px" cellspacing="0" cellpadding="0" border="0"
> style="table-layout: fixed">
> <colgroup>
> <tbody>
> <tr>
> <td align="left">
> <div id="section-title-holder" class="section-title-holder">
> *<span id="lblTitleHolder">Welcome</span>*
>
--
--
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.