P
PP
Now I have a problem. What I want is some urls in a certain table of a
web page. How could I get these URLs and save them as an array so as to
visit the web pages that these URLs navigate to.
My codes as follows:
##
require'Watir'
ie=Watir::IE.new
ie.goto("www.baidu.com")
n=ie.links.length
puts n
i=1
j=1
a1=Array.new #a1 is used to store all the links in the
page
a2=Array.new #a2 is used to store the certain links
that contains the string 'baidu'
while i<n
a1=ie.links.to_s
if a1.matches(/.*baidu.*/)
puts a1
a2[j]=a1
else puts "not found"
j=j+1
end
i=i+1
end
##
The result shows "not found" n times
Can anyone help me ?
web page. How could I get these URLs and save them as an array so as to
visit the web pages that these URLs navigate to.
My codes as follows:
##
require'Watir'
ie=Watir::IE.new
ie.goto("www.baidu.com")
n=ie.links.length
puts n
i=1
j=1
a1=Array.new #a1 is used to store all the links in the
page
a2=Array.new #a2 is used to store the certain links
that contains the string 'baidu'
while i<n
a1=ie.links.to_s
if a1.matches(/.*baidu.*/)
puts a1
a2[j]=a1
else puts "not found"
j=j+1
end
i=i+1
end
##
The result shows "not found" n times
Can anyone help me ?