Before Internet Explorer was discontinued, I used this working VBA code to open a website, it was fired via button click in Excel:
Sub OpenWebsiteVBA()
Dim URL as String
Dim RefString as String
Dim oIE As InternetExplorer
Set oIE = New InternetExplorer
With oIE
URL = "https://www.xxxxxxxxxxx.com/index.php?button=Search"
RefString = "ver_name=All&order_by=2&land_abk=eg&ver_id=3"
.Navigate2 URL, Headers:="Referer: " & RefString '<= how to do this with selenium?
End With
End Sub
Microsoft Edge + edgedriver are installed & the Selenium Type Library reference is already added in Excel, but unfortunately I have no advanced knowledge with Selenium and no idea how to integrate the REFERER-code here, so I would be very grateful for support. Which browser doesn't matter, the main thing is that it allows header-post so that I can open the website in it.
Sub OpenWebsiteSELENIUM()
Dim URL As String
Dim RefString As String
Set oEdge = New WebDriver 'or Set oIE = New ChromeDriver
With oEdge
URL = "https://www.xxxxxxxxxxx.com/index.php?button=Search"
RefString = "ver_name=All&order_by=2&land_abk=eg&ver_id=3"
.start "edge" 'or .start "chrome"
'.AddArgument ("Referer:" & RefString) <= doesn't work!
'.SetPreference "Headers: ", "Referer: " & RefString <= doesn't work!
'.SetPreference "Referer: ", RefString <= doesn't work!
'.SetPreference "Referer", RefString <= doesn't work!
'.SetPreference "Referer=", RefString <= doesn't work!
.Get URL
End With
End Sub