Results 1 to 4 of 4

Thread: Control the Chrome browser with Chromdirver for web page automation

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    683

    Control the Chrome browser with Chromdirver for web page automation

    Control the Chrome browser with Chromdirver for web page automation


    There are a lot of similar codes, but very few pure VB ones. This is the code I used to write by referring to other people's code and fumbling through it. FYI. If there are errors, fix them. It is recommended to use Chrome 68.0.3440.75 to pass the test

    Chromedirver.exe and Chrome.exe put it in the same directory
    -bas
    -cls
    -Chrome---- 68.0.3440.75
    ----Dictionaries
    -----Profile 1
    -----chrome.exe
    -----chromedriver.exe ***must can usde for your Chrome.EXE the version you use
    -ChromeControl.vbp


    If you are using a newer version of Chrome, please modify ChromeOptions.CLS .

    It can be replaced with the code below

    Code:
    Private Sub Class_Initialize()
        Set Jb = New JsonBag
        
        mChromeOption = "{'desiredCapabilities':{'browserName':'chrome', "
        mChromeOption = mChromeOption & "'proxy':{'proxyType':'system','autodetect':'false','httpProxy':'127.0.0.1:8080','ftpProxy':'127.0.0.1:8080','sslProxy':'127.0.0.1:8080','noProxy':'','socksUsername':'cake','socksPassword':'madewithcake'},"
        mChromeOption = mChromeOption & "'version':'','loggingPrefs': "
        mChromeOption = mChromeOption & " {'browser':'ALL','driver':'ALL','performance':'ALL'}, "
        mChromeOption = mChromeOption & "'platform':'ANY','goog:chromeOptions':{'extensions':[],'prefs':{ 'credentials_enable_autosignin': true, 'credentials_enable_service': false,'last_clear_browsing_data_tab':1, "
        mChromeOption = mChromeOption & "'browser':{'check_default_browser':false,'clear_data':{'browsing_history_basic':true,'cache_basic':true,'cookies_basic':true}}, "
        mChromeOption = mChromeOption & "'profile':{'managed_default_content_settings':{'images':1,'popups':1},'autofill': { 'enabled': true,'orphan_rows_removed': true},'default_content_setting_values':{'sound':1}}, "
        mChromeOption = mChromeOption & "'download':{'default_directory':'C:\\','directory_upgrade':true,'prompt_for_download':true},'savefile':{'default_directory':'C:\\'}}, "
        mChromeOption = mChromeOption & "'args':['--disable-infobars','--disable-javascript','--window-size=600,500']}}}"
        Debug.Print Replace$(mChromeOption, "'", Chr(34))
        
        Jb.JSON = Replace$(mChromeOption, "'", Chr(34))
        
    End Sub
    The code used is widely referenced by the open source masters in the forum, such as dilettante, wqweto, Elory, scmidt and many others.Thanks for sharing

    If you have any questions about Chromedirver, please do your own searching, as it is difficult for us to use external apps such as google due to network restrictions

    It is possible to get the commands and formats we send through the http communication between the listener and Chromedirver, which is helpful to understand
    Attached Files Attached Files
    Last edited by xxdoc123; Mar 16th, 2024 at 08:57 PM.

  2. #2
    Fanatic Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    514

    Re: Control the Chrome browser with Chromdirver for web page automation

    you can share the direct link to Chrome 68.0.3440.75 .zip

  3. #3
    Hyperactive Member
    Join Date
    Jan 2015
    Posts
    323

    Re: Control the Chrome browser with Chromdirver for web page automation


  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    683

    Re: Control the Chrome browser with Chromdirver for web page automation

    Quote Originally Posted by yokesee View Post
    you can share the direct link to Chrome 68.0.3440.75 .zip
    You can use the latest version of Chrome, but you'll have to find a matching Chromedriver

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width