Edge VB Script to load page and clear cache

Gary Ray 1 Reputation point
2021-10-07T09:22:55.223+00:00

I am trying to figure out how to do a VB script to load a page on Edge and then clear the cache.

So far I can get the page to load but cannot find the cache part.

Set objShell = CreateObject("WScript.Shell")
objShell.Run "msedge http://ceto/dhms/login.aspx"

Please advise

Developer technologies VB
Microsoft Edge Microsoft Edge development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-10-08T09:26:34.63+00:00

    Hi @Gary Ray

    You can achieve what you want using Seleniumbasic. Seleniumbasic is a Selenium based browser automation framework for VB.Net , VBA and VBScript. Before writing the code, there're some steps needing to be followed:

    1. Download the latest version of SeleniumBasic v2.0.9.0 from this link and install it.
    2. Download the corresponding version of Edge WebDriver from this link.
    3. Find the path of SeleniumBasic which is C:\Users\%username%\AppData\Local\SeleniumBasic in my situation (it might also be in this path C:\Program Files\SeleniumBasic), copy the Edge WebDriver msedgedriver.exe to this path.
    4. Rename msedgedriver.exe to edgedriver.exe.

    The VBScript code is like below. You can first open Edge, then navigate to edge://settings/clearBrowserData and automate the browser to clear the cache:

    Dim driver  
      
    Set driver = CreateObject("Selenium.EdgeDriver")  
    driver.Get "https://www.google.com"  
    driver.Wait 5000  
    driver.Get "edge://settings/clearBrowserData"  
    driver.FindElementById("clear-now").Click  
    driver.Wait 5000  
    driver.Quit  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Regards,
    Yu Zhou


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.