Manipulate Google Chrome with VBA

0

I am creating code that goes into my company's online system, but it can only be accessed by Google Chrome.

The code to open Chrome is this:

Sub Chrome()

    Dim GC As Object
    Dim WebUrl As String
    Dim NavigatorAddress As String

    Let NavigatorAddress = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    Set GC = CreateObject("InternetExplorer.Application")
    Let WebUrl = "http://endereço/do/sistema"

    Shell (NavigatorAddress & " -url " & WebUrl)

    GC.Document.all("vUSU_CODIGO").innerText = "login"
    GC.Document.all("vSENHA").innerText = "sennha"

    GC.Document.all("vUSU_CODIGO").form.all("BUTTON1").Click

End Sub

The code opens Chrome on the right link and everything else, but I can not complete the login or the password.

    
asked by anonymous 31.05.2017 / 22:27

1 answer

-2

Yes, it is possible (for a long time!) to automate procedures in browsers. In your case, the only component that exposes objects, properties and methods is Internet Explorer (a quick search for "InternetExplorer.Application" already gives the exact results with the full explanation on the topic, direct from the MS). The others can be automated with the use of other libraries, such as Selenium WebDriver ( link ). Good luck!

    
15.08.2017 / 17:12