SeleniumBasic操作运行中的Chrome浏览器

今天用免费云服务器,三丰云,做操作浏览器自动化的VB程序。

如何自动化已经打开的浏览器?

http://chromedriver.storage.googleapis.com/index.html

首先寻找驱动,最新的驱动只支持到浏览器114,我在网上下载的浏览器是94.0.4606.81(64位版本),selenium驱动下载的是94.0.4606.61/chromedriver_win32.zip,位数不一致竟然也可以。

浏览器和驱动都解压或安装到I:\install\Chrome94\ 文件夹下。

命令行中输入以下命令:

"I:\install\Chrome94\Google94.exe" --remote-debugging-port=9999 --user-data-dir="C:\Windows\Temp"

输入以上命令,打开了浏览器。

bash 复制代码
Private WD As SeleniumBasic.IWebDriver
'"I:\install\Chrome94\Google94.exe" --remote-debugging-port=9999 --user-data-dir="C:\Windows\Temp"
Sub Baidu()
    'On Error GoTo Err1
    Dim Service As SeleniumBasic.ChromeDriverService
    Dim Options As SeleniumBasic.ChromeOptions
    Set WD = New SeleniumBasic.IWebDriver
    Set Service = New SeleniumBasic.ChromeDriverService
    With Service
        .CreateDefaultService driverPath:="I:\install\Chrome94\"
        .HideCommandPromptWindow = True
    End With
    Set Options = New SeleniumBasic.ChromeOptions
    With Options
        .BinaryLocation = "I:\install\Chrome94\Google94.exe"
        .DebuggerAddress = "127.0.0.1:9999"
    End With
    WD.New_ChromeDriver Service:=Service, Options:=Options
    WD.url = "https://www.baidu.com"
End Sub
Private Sub Form_Load()
Baidu
End Sub

运行以上代码,在打开的浏览器,打开了百度。

相关推荐
WG_1716 小时前
Linux:进程控制
前端·chrome
TeleostNaCl1 天前
Google Chrome 浏览器历史记录的存储位置
前端·chrome·经验分享
天天向上10241 天前
成功阻止chrome浏览器自动填充密码
服务器·前端·chrome
元气满满-樱1 天前
Nginx虚拟主机实验
运维·chrome·nginx
尼罗河女娲1 天前
【测试开发】Selenium + Chrome 自动化中常用 ChromeOptions 参数说明(实践总结)
chrome·selenium·自动化
JANG10242 天前
【Linux】进程
linux·网络·chrome
油丶酸萝卜别吃2 天前
修改chrome配置,关闭跨域校验
前端·chrome
私人珍藏库2 天前
[吾爱大神原创工具] FlowMouse - 心流鼠标手势 v1.0【Chrome浏览器插件】
前端·chrome·计算机外设
zhaotiannuo_19982 天前
渗透测试之后端编程PHP
开发语言·chrome·php
QT 小鲜肉3 天前
【Linux命令大全】001.文件管理(理论篇)
linux·数据库·chrome·笔记