Home > Software engineering >  Add element from excel range Selenium
Add element from excel range Selenium

Time:11-25

How to add element from excel range?

bot.findelementbypartiallinktext(Worksheets("Sheet1").Range("A1").value).click

CodePudding user response:

This code is showing the first match it founds. If you want you can loop through all the links.

Sub ByPartialLinkText()
    
    '................
    
    Dim ResultLinks As Selenium.WebElements
    
    Set ResultLinks = bot.FindElementsByPartialLinkText(Worksheets("Sheet1").Range("A1").value)
    If ResultLinks.Count > 0 Then
        ResultLinks(1).Click
    End If
        
    '................
End Sub
  • Related