GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - GCuser99/SeleniumVBA: A comprehensive Selenium wrapper for browser automation developed for MS Office VBA running in Windows

BranchesTags
Open more actions menu

Latest commit

 

History

732 Commits
732 Commits

Folders and files

NameName
Last commit message
Last commit date
dev
dev
 
 
dist
dist
 
 
src
src
 
 
test
test
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 

Repository files navigation

SeleniumVBA

A comprehensive Selenium wrapper for browser automation developed for MS Office VBA running in Windows

Features

  • Edge, Chrome, and Firefox browser automation support
  • MS Excel Workbook, MS Access DB, and twinBASIC ActiveX DLL solutions available
  • A superset of Selenium's W3C WebDriver commands - over 400 public methods and properties
  • Support for HTML DOM, Action Chains, SendKeys, Shadow Roots, Cookies, ExecuteScript, and Capabilities
  • ExecuteCDP method exposing Chrome DevTools Protocol - a low-level interface for browser interaction.
  • Automated Browser/WebDriver version alignment - works out-of-the-box with no manual downloads necessary!
  • Help documentation is available in the SeleniumVBA Wiki

What's New?

  • Now WebDriver BiDi compatible - see hanamichi77777's WebDriver BiDi for SeleniumVBA GitHub repo
  • Featured on Sancarn's curated Awesome VBA list Awesome

Setup

SeleniumVBA will function right out-of-the-box. Just download/install any one of the provided SeleniumVBA solutions and then run one of the subs in the "test" Standard modules. If the Selenium WebDriver does not exist, or is out-of-date, SeleniumVBA will detect this automatically and download the appropriate driver to a configurable location on your system.

Driver updates can also be programmatically invoked via the WebDriverManager class.

The twinBASIC ActiveX DLL solution requires no dependencies (such as .Net Framework). To try it, download and run the installer in the dist folder.

SendKeys Example

Sub doSendKeys()
    Dim driver As New WebDriver
    Dim keys As New WebKeyboard
    
    driver.StartChrome
    driver.OpenBrowser
    
    driver.NavigateTo "https://www.google.com/"
    driver.Wait 1000
    
    keySeq = "This is COOKL!" & keys.Repeat(keys.LeftKey, 3) & keys.DeleteKey & keys.ReturnKey
    
    driver.FindElement(By.Name, "q").SendKeys keySeq
    driver.Wait 2000
    
    driver.CloseBrowser
    driver.Shutdown
End Sub

File Download Example

Sub doFileDownload()
    Dim driver As New WebDriver
    Dim caps As WebCapabilities
   
    driver.StartChrome
    
    'set the directory path for saving download to
    Set caps = driver.CreateCapabilities
    caps.SetDownloadPrefs downloadFolderPath:=".\"
    driver.OpenBrowser caps
    
    'delete legacy copy if it exists
    driver.DeleteFiles ".\test.pdf"
    
    driver.NavigateTo "https://github.com/GCuser99/SeleniumVBA/raw/main/dev/test_files/test.pdf"

    'wait until the download is complete before closing browser
    driver.WaitForDownload ".\test.pdf"
    
    driver.CloseBrowser
    driver.Shutdown
End Sub

Action Chain Example

Sub doActionChain()
    Dim driver As New WebDriver
    Dim keys As New WebKeyboard
    Dim actions As WebActionChain
    Dim elemSearch As WebElement
    
    driver.StartChrome
    driver.OpenBrowser
    
    driver.NavigateTo "https://www.google.com/"
    driver.Wait 1000
    
    Set elemSearch = driver.FindElement(By.Name, "btnK")
    
    Set actions = driver.ActionChain
    
    'build the chain and then execute with Perform method
    actions.KeyDown(keys.ShiftKey).SendKeys("upper case").KeyUp(keys.ShiftKey)
    actions.MoveToElement(elemSearch).Click().Perform

    driver.Wait 2000
    
    driver.CloseBrowser
    driver.Shutdown
End Sub

Collaborators

@6DiegoDiego9 and @GCUser99

Credits

This project is an extensively modified/extended version of uezo's TinySeleniumVBA

VBA-JSON by Tim Hall, JSON converter for VBA

RubberDuck by Mathieu Guindon

twinBASIC by Wayne Phillips

Inno Setup by Jordan Russell

vba-regex by sihlfall

About

A comprehensive Selenium wrapper for browser automation developed for MS Office VBA running in Windows

Topics

accesschromeedgeexcelfirefoxseleniumtwinbasicvbawebdriver

Resources

Readme
MIT license
Activity

Stars

142 stars

Watchers

17 watching

Forks

28 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.