[wtr-general] How to identify an element in a table

45 views
Skip to first unread message

Cristina

unread,
May 20, 2010, 9:36:48 AM5/20/10
to watir-...@googlegroups.com
Hi,

when I have to check into my application that when I click on a link the content is loaded.

Well here is a piece of code of a table that is loaded::

<br>
<table class="main" cellspacing="1" cellpadding="2" border="0" align="center">
<tbody>
<tr class="heading">
<th>
</th>
<th>Status</th>
<th>Staff</th>
<th nowrap="">
</th>
<th>Organization Name</th>
<th>Allowed TLD's</th>
</tr>
<tr class="soft">


If I would like to check that "Status" or "Organization Name" exist on the page, how can I identify that based on that code.

Hope one enconterred that problem and we have a sollution.


Thanks a lot,
Cristina




--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.
 
You received this message because you are subscribed to http://groups.google.com/group/watir-general
To post: watir-...@googlegroups.com
To unsubscribe: watir-genera...@googlegroups.com

Željko Filipin

unread,
May 20, 2010, 10:16:09 AM5/20/10
to watir-...@googlegroups.com
On Thu, May 20, 2010 at 3:36 PM, Cristina <cristina...@gmail.com> wrote:
> <th>Status</th>
> <th>Organization Name</th>

> If I would like to check that "Status" or "Organization Name" exist on the page

Several solutions come to mind (none of them tested).

1)
browser.text.include? "Status"
browser.text.include? "Organization Name"

(Not sure is it "include?" or "includes?")

2)
browser.table(how, what)[number][number].text == "Status"
browser.table(how, what)[number][number].text == "Organization Name"

3)
browser.table(how, what).th(:text, "Status").exist?
browser.table(how, what).th(:text, "Organization Name").exist?

(Not sure is it "exist?" or "exists?")

4)
browser.table(how, what).cell(:text, "Status").exist?
browser.table(how, what).cell(:text, "Organization Name").exist?

Željko
Reply all
Reply to author
Forward
0 new messages