Replies: 3 comments 1 reply
-
Thanks for the example! About CreateObject("SeleniumVBA.WebDriver"), does it require the registration of the DLL, right? |
Beta Was this translation helpful? Give feedback.
-
Apparently VBScript does not support DLL API declarations, so even though the SeleniumVBA DLL can be used without registration using API declarations to instantiate the class objects (late bound of course), I could not find a direct way to this with VBScript. Bummer... |
Beta Was this translation helpful? Give feedback.
-
Not my area of expertise and I didn't try that, anyway this is what the new Bing answers: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The SeleniumVBA DLL solution can be used in your VBScripts, with a few caveats.
To demonstrate, let's try to replicate one of the test subroutines in VBA using a VBScript. In the SeleniumVBA test routines there is a test_download_resource subroutine that looks like this in VBA:
The VBA subroutine above demonstrates the DownloadResource method by downloading the SeleniumVBA logo file from GitHub repository.
To replicate this using VBScript, create a text file called "test_download_resource.vbs" and open it with a text editor such as notepad. Copy/paste the following into the file:
After pasting the above into the file, modify the folder path "%USERPROFILE%\Documents\SeleniumVBA\scripts" to a valid absolute path of your choosing to save the logo file to. Then save and close the file (make sure you gave the file a "vbs" extension!).
From the Windows File Explorer, double click on the saved VBScript file. You will see the twinBasic banner for 5 seconds, then the browser navigation to the web page. After the script has executed, you should find the logo.png file in whichever folder that you specified above. It's that easy.
For more examples of using SeleniumVBA in VBScript, see the vbscript folder in this repository.
In summary, the use of SeleniumVBA in VBScript can provide a light-weight alternative to using it in MS Excel and Access when those applications are not central to the scripting objective.
Have an example to share, a question, or suggestion? Feel free to contribute to this discussion!
Beta Was this translation helpful? Give feedback.
All reactions