Excel VBA Chrome Selenium Cannot click button

Viewed 199

Chrome can click the Log in button if using ChromeNoCache sub. But Chrome cannot click the Log in button if using the ChromeCache sub, and I cannot figure out why. Please help make it click the Log in button.

Public WD As New WebDriver

Sub ChromeNoCache() 'browser does NOT remember user and password for subsequent logins
        Call seleniumnocache("https://tap.revenue.wi.gov/mta/_/")
            WD.FindElementById("Dd-5").SendKeys "user"
            WD.FindElementById("Dd-6").SendKeys "password"
            WD.FindElementById("Dd-7").click  'This click works fine
End sub
Sub ChromeCache() 'browser remembers user and password for subsequent logins
        Call selenium("https://tap.revenue.wi.gov/mta/_/")
            WD.FindElementById("Dd-5").SendKeys "user"
            WD.FindElementById("Dd-6").SendKeys "password"
            WD.FindElementById("Dd-7").click  'This click is ignored by Chrome and does not work
End sub
Sub Selenium(curl)  'web will not ask for security code in subsequent logins
    On Error GoTo d1
    usernam = CreateObject("WScript.Network").UserName  '.ComputerName   .UserDomain
    Set oShell = CreateObject("WScript.Shell")
    spath = "C:\Users\" & usernam & "\AppData\Local\SeleniumBasic"  ' shm.Range ("i3")
    oShell.Run "chrome.exe -remote-debugging-port=9014 --user-data-dir=""""" & spath & """"""
    Set oShell = Nothing
    WD.SetCapability "debuggerAddress", "localhost:9014"
    WD.Start "Chrome", ""
    GoTo d2
    d1:
    WD.Start "Chrome", ""
    d2:
    WD.Get curl
End Sub

Sub seleniumnocache(curl)
    WD.Start "Chrome", ""
    WD.Get curl
End Sub


0 Answers
Related