首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >设置Profile Chrome WebDriver Selenium VBA

设置Profile Chrome WebDriver Selenium VBA
EN

Stack Overflow用户
提问于 2020-03-01 15:39:31
回答 1查看 3.8K关注 0票数 1

我试图设置一个铬的配置文件,但它不起作用。

Chrome版本:版本80.0.3987.106

WebDriver: ChromeDriver 80.3987.106

Selenium Basic: SeleniumBasic-2.0.9.0.exe

代码语言:javascript
运行
复制
Option Explicit
Public Sub openGChrome()
    Dim obj As New WebDriver
    Dim i As Integer

    Const URL = "https://www.linkedin.com/feed/"
    Const JS_PROFILE As String = "C:\Users\ChuckNorris\AppData\Local\Google\Chrome\User Data\Default"
    Set obj = New ChromeDriver
    With obj
        .SetProfile JS_PROFILE, True
        .Get URL
         Stop
        .Quit
    End With
End Sub

我做错什么了?有什么帮助吗?

编辑:浏览器打开,但我没有任何个人资料选择,我不能登录到没有登录的网站

EN

回答 1

Stack Overflow用户

发布于 2020-03-01 17:28:45

您没有指定什么“不工作”,但我认为您应该从配置文件路径中删除\Default,因为当您不指定配置文件的名称时,意味着您要使用默认配置文件,然后就会隐式地添加\Default。

若要指定默认配置文件以外的特定配置文件,请使用:

代码语言:javascript
运行
复制
.AddArgument ("profile-directory=foldername") 'foldername is the name of the folder with the profile you want to use
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60476778

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档