如何在Selenium中使用默认浏览器配置文件而不是新的? [英] How to use default browser profile in Selenium instead of new one?

查看:33
本文介绍了如何在Selenium中使用默认浏览器配置文件而不是新的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到任何相关的答案,我的问题很简单.

I couldn't find any relevant answers and my question is pretty straight forward.

上下文并不真正相关.

对于Selenium来说,在执行编码操作时使用我通常安装的浏览器(Chrome或Firefox)对我来说非常重要.

It is very important for me that Selenium uses my normally installed browser (Chrome or Firefox), when doing coded things.

推荐答案

也许使用您的标准配置文件会有所帮助?在我的情况下,网站正在检测Selenium浏览器.这段代码解决了我的问题.

Maybe using your standard profile helps? It did in my case where the website was detecting the Selenium browser. This code solved my problem.

path = str(Path.home())
path = path + "/.mozilla/firefox/xxxx.default-release"
profile = FirefoxProfile(path)
driver = webdriver.Firefox(profile)

这篇关于如何在Selenium中使用默认浏览器配置文件而不是新的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆