show_links

C

chris.defelice

Does anyone know of a way to store the output of show_links as an
array? I've tried setting the array equal to something like
ie.frame("mainFrame").show_links but the array always comes back as
nil.

I basically need this so I can loop through all the links on a page and
do various automated tests.
 
C

ChrisH

show_links grabs the links and sends them to stdout

it uses doc.links, so that may be what you need

cheers
 
P

pmr.nitrobackup

Does anyone know of a way to store the output of show_links as an
array? I've tried setting the array equal to something like
ie.frame("mainFrame").show_links but the array always comes back as
nil.

I basically need this so I can loop through all the links on a page and
do various automated tests.

you need to do this:

ie.frame("mainFrame").links.each do |this_link|
# do something with this_link,
# eg puts this_link.to_s
# this_link.click
# etc
end

Paul
 
C

chris.defelice

you need to do this:

ie.frame("mainFrame").links.each do |this_link|
# do something with this_link,
# eg puts this_link.to_s
# this_link.click
# etc
end

Paul

Thanks! That helped a lot
 
P

pmr.nitrobackup

Does anyone know of a way to store the output of show_links as an
array? I've tried setting the array equal to something like
ie.frame("mainFrame").show_links but the array always comes back as
nil.

I basically need this so I can loop through all the links on a page and
do various automated tests.

you need to do this:

ie.frame("mainFrame").links.each do |this_link|
# do something with this_link,
# eg puts this_link.to_s
# this_link.click
# etc
end

Paul
 
C

Chris

This is how I was able to fill an array with just the actual hyperlinks
of all the links on a page:

linkcount = Array.new
length = ie.document.frames.length

for i in 1..length
linkcount = ie.frame:)index, i).links.length
for y in 1..linkcount
ar[y] = ie.frame:)index, i).links[y].href
end
i = i + 1
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,206
Messages
2,571,071
Members
47,678
Latest member
Aniruddha Das

Latest Threads

Top