为了账号安全,请及时绑定邮箱和手机立即绑定

如何在Selenium Webdriver Python 3中使用Chrome配置文件

如何在Selenium Webdriver Python 3中使用Chrome配置文件

猛跑小猪 2019-12-06 10:57:52
因此,每当我尝试使用Chrome设置(我在默认浏览器中使用的设置)时,通过添加options = webdriver.ChromeOptions()options.add_argument("user-data-dir=C:\Users\... (my webdriver path)")driver = webdriver.Chrome(executable_path="myPath", options=options)它告诉我错误代码SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes n 16-17: truncated \UXXXXXXXX escape以我的重击。我不知道这意味着什么,我很乐意得到任何帮助。提前致谢!
查看完整描述

3 回答

?
拉丁的传说

TA贡献1789条经验 获得超8个赞

确保您已找到配置文件的正确路径,并且在所述路径中两次转义了反斜杠。


例如,通常,Windows上的默认配置文件位于:


"C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\Default"


查看完整回答
反对 回复 2019-12-06
  • 3 回答
  • 0 关注
  • 1121 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信