Project https://florentbr.github.io/SeleniumBasic/ updated 9 years ago. I have installed fresh version of https://github.com/mozilla/geckodriver/releases (I place PATH of geckodriver to system PATH), also FF I have in fresh version. AI support get me this pattern to call SeleniumBasic:
Dim driver As New Selenium.FirefoxDriver
Dim FirefoxOptions As Object
Set FirefoxOptions = CreateObject("Selenium.Firefox.FirefoxOptions")
FirefoxOptions.SetBinary("C:\Program Files\Mozilla Firefox\firefox.exe") 'Example path; adapt as needed
driver.SetCapability "moz:firefoxOptions", "{""args"": [""-headless""]}", FirefoxOptions 'Optional: For headless mode
driver.Start "firefox", "D:\Geckodriver\geckodriver.exe" , "https://www.example.com" ' Specify path here
driver.Get "your-website-url"
driver.FindElementById("elementId").SendKeys "your value" & Chr(13) 'Using ID
driver.FindElementByName("elementName").SendKeys "your value" & Chr(13) 'Using name
driver.FindElementByCss("input[type='text']").SendKeys "your value" & Chr(13) 'Using CSS selector
driver.Quit
End Sub
Unfortunately, even simplest attempt to call SeleniumBasic get me error - "Firefox failed to open listening port 127.0.0.1:xxx"
It something wrong with my tuning (security or something other) or this is not workable project at all?
I still use selenium wth VBA. Most of my projects I use with Chrome. A few important things:
Usually, I just use:
Dim bot As New WebDriver
bot.Start "chrome", weburl
bot.Get "site"
bot.FindElementById("elementId").SendKeys "your value"
if you send the website that you are trying to login, I can help mapping the elements Note: DO NOT share your login and password