Hello Anna,

I really appreciate your help (I couldn't progress without your help).

All my problems are seem to be sorted.

Thanks again,

Guy

On Sep 19, 10:30 am, Anna Gabutero <[email protected]> wrote:
> On Thu, Sep 17, 2009 at 09:22:19AM -0700, Guy wrote:
> > 1). How can I get the text out of <em> tag for each div? that tag
> > seems as not supported.
>
> The latest git version supports <em>:
>
> http://github.com/bret/watir/commit/1a8e3368b7e7ce790f8a596a7d8bcefe0...http://github.com/bret/watir/commit/52557ea6936f847c4ee0578608fd03625...
>
> Unfortunately, to get this, you'll have to build Watir yourself
> (http://wiki.openqa.org/display/WTR/Building+Watir) or port the above
> commits into your sources.
>
> There is also the quick and dirty way, courtesy of String#scan:
>
>   ie.div(:id, 'resultsList').lis.each do |element|
>     puts element.link(:url, /job/).text.scan(/<em>(.*)<\/em>/)
>   end
>
> > The xpath works great but for the <em> tag only - ie.element_by_xpath
> > ("//em").innerText
>
> > <div id=resultsList class=><ol id="searchResultsList"><li><span
> > class="jobsearchNumber">1<input type="checkbox" name="chkJob"
> > onClick="UpdateSelectedItems();" value="16015024"></input></
> > span><div><h2><a href="/job/file-migration-b-analyst-b/gold-coast/
> > 16015024/">File Migration <span class="highlight">Analyst</span></a>
> >                             <em>TLC ITStaff</em></h2>
>
> > 2). Is there a generic method/procedure to iterate for all results
> > page/s?
>
> You have to write your own based on the structure of the site/page.  You
> can use the exists? method to check for the presence of an element:
>
>   ie.link(:text, 'Next').exists?
>
> This won't give you an error even if there's no Next link on the page.
>
> By the way, Watir offers many selection methods so you may want to check
> out this page:
>
> http://wiki.openqa.org/display/WTR/Methods+Supported+by+Element
>
> XPath is really overkill for many cases.
>
> - Anna
>
>
>
> > Follows the html:
>
> > <span class="frame"><span class="frameStart"><i></i></span>
> >                 <div class="contentBox firstBox">
> >                     <h1><span
> > id="ContentInclude_YourQuery1_ResultsLabel"><strong>1</strong> -
> > <strong>2</strong> of <strong>2</strong> </span><span>jobs  containing
> > <strong>test analyst</strong> in <strong>Gold Coast</strong></span>
>
> > or
> > check if the 'Next' exists (how can I handle a scenario with no
> > 'Next' (just one page with  or no results at all):
> >  ie.element_by_xpath("//strong[contains(text(),'Next')]").click  (this
> > works but how can I handle just one page or no results at all)
>
> >       <div class='searchPagination'><dl class='jobSearchPagination'>
> > <a class='nextPage btn pinkbtn_small' href="javascript: PageTo
> > (2)"><strong>Next<img src='/general_ID_items/images/other/
> > bullet_search_white_small.gif'></strong></a><dt>Page</dt><dd
> > class='currentPage'><span>1</span></dd>
> > <dd><a href="javascript: PageTo(2)">2</a></dd>
> > <dd><a href="javascript: PageTo(3)">3</a></dd>
> > <dd><a href="javascript: PageTo(4)">4</a></dd>
> > <dd><a href="javascript: PageTo(5)">5</a></dd>
> > <dd><a href="javascript: PageTo(6)">6</a></dd>
> > <dd><a href="javascript: PageTo(7)">7</a></dd>
> > <dd><a href="javascript: PageTo(8)">8</a></dd>
> > <dd><a href="javascript: PageTo(9)">9</a></dd>
> > <dd><a href="javascript: PageTo(10)">10</a></dd></dl></div>
> >    </div>
>
> > Thank U  all for the helpful support
>
> > Guy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to