How to set the URL of a link to a variable using WATIR
- by Alex
Using WATIR and Excel, I'd like to take the first row of a table in Excel, visit the URL, then set the 12th link on the page as a variable in the cell next to the cell with the URL, then go to the next line and repeat.
I'm stuck on getting the URL of the 12th link on the page to set as a variable that I can feed into the next cell in Excel. Here's what I have and it's not working.
worksheet = workbook.WorkSheets(1) # get first workbook
#declare test site
test_site = worksheet.Range("a2").text
#open ie
ie = Watir::IE.new
#go to test_site
ie.goto test_site
#find primlink
ie.link(:index, 12).text = "primlink"
puts primlink
Any ideas?