GCuser99 / SeleniumVBA

A comprehensive Selenium wrapper for browser automation developed for MS Office VBA running in Windows
MIT License
89 stars 18 forks source link

Updated Edge, now getting 'invalid session id' error #105

Closed bryshen closed 4 months ago

bryshen commented 4 months ago

After updating to Edge 125.0.2535.85, previously working code now gives 'invalid session id' error.

The browser opens just fine. But the return is always the same after running any command to the driver.

GCuser99 commented 4 months ago

Hi @bryshen, can you provide us more info? Are you using MS Office 32-bit or 64? Are you using SeleniumVBA.xlsm, SeleniumVBA.accdb or the DLL solution? Are you letting SeleniumVBA manage the browser/driver alignment by default or are you downloading drivers manually?

I just tried with Edge 126.0.2592.68 and all works ok.

Can you try the sub below and tell us what gets printed in the Debug window?

Sub test_checkBrowserAndDriver()
    Dim mngr As WebDriverManager
    Dim installedBrowserVersion As String
    Dim installedDriverVersion As String
    Dim compatibleDriverVersion As String

    Set mngr = New WebDriverManager

    'mngr.DefaultDriverFolder = [your binary folder path here] 'defaults to Downloads dir
    installedBrowserVersion = mngr.GetInstalledBrowserVersion(Edge)
    installedDriverVersion = mngr.GetInstalledDriverVersion(Edge)
    compatibleDriverVersion = mngr.GetCompatibleDriverVersion(Edge, installedBrowserVersion)

    Debug.Print "Installed Browser Version: " & installedBrowserVersion
    Debug.Print "Installed Driver Version: " & installedDriverVersion
    Debug.Print "Compatible Driver Version: " & compatibleDriverVersion
End Sub
GCuser99 commented 4 months ago

Oh, I should also ask because it has happened before :-), are you using SeleniumVBA or SeleniumBasic?

bryshen commented 4 months ago

I'm using SeleniumVBA.xlsm with MS Office 64-bit and letting SeleniumVBA manage the browser/driver alignment by default.

Sub output: Installed Browser Version: 125.0.2535.85 Installed Driver Version: 125.0.2535.92 Compatible Driver Version: 125.0.2535.92

bryshen commented 4 months ago

@GCuser99 After restarting my machine a few times, this issue fixed itself. Not sure what was happening, but this seems to have been a system issue.

GCuser99 commented 4 months ago

Hmm, I'm not sure I've ever seen (or noticed) the driver version getting ahead of the browser version, but I know @6DiegoDiego9 uses Edge a lot so maybe he can weigh in on what's going on. To see if we can isolate if the driver is not compatible with browser, can you try installing a different driver and try your code again??

Sub test_checkBrowserAndDriver()
    Dim mngr As WebDriverManager
    Dim installedBrowserVersion As String
    Dim installedDriverVersion As String

    Set mngr = New WebDriverManager

    'install an earlier driver version that matches the browser version exactly
    mngr.DownloadAndInstallDriver Edge, "125.0.2535.85"

    'mngr.DefaultDriverFolder = [your binary folder path here] 'defaults to Downloads dir
    installedBrowserVersion = mngr.GetInstalledBrowserVersion(Edge)
    installedDriverVersion = mngr.GetInstalledDriverVersion(Edge)

    Debug.Print "Installed Browser Version: " & installedBrowserVersion
    Debug.Print "Installed Driver Version: " & installedDriverVersion
End Sub

I just tried installing that driver version and it even seems to work with Edge browser 126.0.2592.68!

GCuser99 commented 4 months ago

Oh, I just saw your message about your system issue - great to hear you fixed it! I'll close this one for now, but we can reopen if you have more issues...