我是硒的新手。
我发现硒不会使用我的本地firefox浏览器。似乎可以创建一个没有插件的全新插件。
但是我想在插件上做一些事情,例如:modify request headers
,aotuproxy
。我只在Java中找到设置标头示例。
尽管可以使用设置代理webdriver.FirefoxProfile().set_preference('network.proxy.http',....
,但要达到我的目标并不是那么好。
因此,我认为让硒使用我的Firefox非常好。但是我无法弄清楚。
好的,我找到答案了。给出配置文件路径就是重点。
def get_ffprofile():
ff_profile_path = 'C:\\Users\\Kasim\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\my89fce2.default'
ff_profile = webdriver.FirefoxProfile(ff_profile_path)
return ff_profile
然后
browser = webdriver.Firefox(firefox_profile=get_ffprofile())
将启动我的浏览器(实际上是使用我的自定义配置文件的浏览器实例)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句