<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blogging and scraping &#187; find_all</title>
	<atom:link href="http://www.tsnpc.com/tag/find_all/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tsnpc.com</link>
	<description></description>
	<lastBuildDate>Tue, 13 Jul 2010 10:27:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>watir to count the links in a search list on a webpage</title>
		<link>http://www.tsnpc.com/watir-to-count-the-links-in-a-search-list-on-a-webpage/</link>
		<comments>http://www.tsnpc.com/watir-to-count-the-links-in-a-search-list-on-a-webpage/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 11:10:25 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[watir]]></category>
		<category><![CDATA[find_all]]></category>
		<category><![CDATA[links]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=190</guid>
		<description><![CDATA[Some times I need to check the amount of the links in a search list, at first I try and failed by: ie.links(:id, /bra bra/).length and then I find a solution by: ie.div(:id, &#8220;searchList&#8221;).links and then by googles, I find a better solution: links_searchlist = ie101.links.find_all { &#124;link&#124; link.class_name == &#8216;permalink&#8217; } puts &#8220;the links [...]]]></description>
			<content:encoded><![CDATA[<p>Some times I need to check the amount of the links in a search list, at first I try and failed by:<br />
ie.links(:id, /bra bra/).length</p>
<p>and then I find a solution by:<br />
ie.div(:id, &#8220;searchList&#8221;).links</p>
<p>and then by googles, I find a better solution:<br />
links_searchlist = ie101.links.find_all { |link| link.class_name == &#8216;permalink&#8217; }<br />
puts &#8220;the links in the searchlist:&#8221;<br />
puts links_searchlist.length</p>
<p>and in another case, following code also works:<br />
searchlistlinks = ie102.links.find_all { |link| link.id =~ /hitURL/ }<br />
links_searchlist = searchlistlinks.length<br />
puts links_searchlist</p>
<p>following can also work:<br />
searchlistlinks = ie33.links.find_all { |link| link.href =~ /something/ }<br />
but be careful that the following (url) will not work:<br />
searchlistlinks = ie33.links.find_all { |link| link.url =~ /something/ }</p>
<p>Recently I found the best solution by google:<br />
links = ie51.div(:id, ‘threadlist’).html.scan(/something/).count<br />
puts links</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/watir-to-count-the-links-in-a-search-list-on-a-webpage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

