How to set the URL of a link to a variable using WATIR
        Posted  
        
            by 
                Alex
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Alex
        
        
        
        Published on 2011-02-07T15:22:58Z
        Indexed on 
            2011/02/07
            15:25 UTC
        
        
        Read the original article
        Hit count: 285
        
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?
© Stack Overflow or respective owner