Another way of checking for text (when you don't care about which particular
element is displaying it) is:
@browser.text =~ /Welcome/
From: Super Kevy <[email protected]>
To: [email protected]
Sent: Friday, January 2, 2015 6:38 AM
Subject: [wtr-general] Re: Watir - Identifying a Span ID and its Text Element
- False
puts @browser.span(:id,'lblTitleHolder').text.to_s
puts @browser.span(:id,'lblTitleHolder').text.include?('Welcome').to_s
puts @browser.html.include?('Welcome').to_s
On Friday, December 26, 2014 4:15:19 PM UTC-6, Ma St wrote:
I have reviewed many posts, but am unable to get passed this. I am basically
trying to verify if the text on the web page is displayed. The text is
"Welcome" under a span id element. It is not clear what the syntax should be
when referencing the text under the span id. I get an error that reads that it
cannot find my element. Is there a special format I should follow? I am new
to Watir and struggling to find documentation on how to identify elements. I
find the documentation, but when I put into practice, I get this error. Thanks.
Error:"#<Watir::Div:0x482254a located=false selector={:id=>"content- holders",
: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> My Ruby File:p
@browser.driver.current_urlmark = @browser.div(:id => "content-holders")
--
--
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.
--
--
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.