I have looked around and have not found a way using get in VBA within excel with selenium. I am trying not open the the browser and still get the url info. Does anyone know a way using selenium in vba to do this? For example:
Option Explicit
Sub TestSelenium()
dim MyBrowser As Selenium.ChromeDriver
Set MyBrowser = New Selenium.ChromeDriver
MyBrowser.Start
driver.Get "https://www.google.com/"
End Sub
I have seen way such as with the html object library
Option Explicit
Public Sub test()
'tools > references > Microsoft HTML Object Library
Dim html As MSHTML.HTMLDocument, xhr As Object
Set xhr = CreateObject("MSXML2.XMLHTTP")
Set html = New MSHTML.HTMLDocument
With xhr
.Open "GET", ""https://www.google.com/"", False
.setRequestHeader "User-Agent", "Safari/537.36"
.Send
html.body.innerHTML = .responseText
Debug.Print html.Title
End With
End Sub
However, I am interested in solving the problem using selenium.
Startline, use this.AddArgument "--headless"MyBrowser..AddArgument "--headless"I wasn't able to get that to work, but it did point me to the correct path.