Home > Mobile >  Getting Type Mismatch error in vba selenium
Getting Type Mismatch error in vba selenium

Time:10-18

In below code I'm getting below error at Set H2Headers = ch.FindElementByTag("h2"):

Run-time error 13: Type mismatch


Private ch As Selenium.ChromeDriver

Sub TestSelenium()
    
    Set ch = New Selenium.ChromeDriver
    
    ch.Start
    ch.Get "https://en.wikipedia.org/wiki/Main_Page"
    
    Dim H2Headers As Selenium.WebElements
    
    Set H2Headers = ch.FindElementByTag("h2")
    
    Debug.Print H2Headers.Count

End Sub

Any help would be appreciated.

CodePudding user response:

Worked with below change:

FindElementsByTag instead of FindElementByTag

  • Related