Search code examples
google-chromebatch-filegoogle-chrome-extensionvbscriptxmlhttprequest

Make XML HTTP request to Chrome Extension from vbscript


Here is the script, I need it to return the DOM of the popup html of my chrome extension:

URL="chrome-extension://jclgkomglckpklainiafinmjchonokdl/popup.html"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Microsoft.XmlHttp")

On Error Resume Next
http.open "GET", URL, False
http.send ""
If err.Number = 0 Then
    Wscript.Echo http.responseText
Else
    Wscript.Echo "error " & Err.Number & ": " & Err.Description
End If
set WshShell = Nothing
Set http = Nothing

It works for sites that have http:// before it, but won't work for the link above. Putting http:// before said link doesn't work either. Is there any way that this could work with the chrome-extension? If not, are there any other suggestions as to how this could be done?

PS the vbscript is part of a batch file so I can just double click to set the extension and its webpages up.


Solution

  • You can't communicate with a Chrome WebExtension from outside the browser. It is internal only.

    You'd have to write your own WebExtension to interface with it or duplicate the functionality already implemented by another extension.

    I advise you read up on the following:

    The only other solution is to use VBScript or another tool that can remote-control the browser directly, such as Selenium.