3
试图用硒2已经安装的插件打开Firefox,但总是有预定义的喜好硒网络驱动程序无法使用自定义prefrences打开Firefox
from selenium import webdriver
driver = webdriver.Firefox()
上面的代码行默认的Firefox配置文件打开启动Firefox浏览器默认个人资料。 如何使用用户指定的首选项启动?
试图用硒2已经安装的插件打开Firefox,但总是有预定义的喜好硒网络驱动程序无法使用自定义prefrences打开Firefox
from selenium import webdriver
driver = webdriver.Firefox()
上面的代码行默认的Firefox配置文件打开启动Firefox浏览器默认个人资料。 如何使用用户指定的首选项启动?
您可以使用类似与自定义配置文件启动它:
profile = FirefoxProfile("path.to.profile")
driver = webdriver.Firefox(profile)
没有必要设置配置文件,它可以自动创建,你只需要路径插件,例如:
string firebugPath = "C:\\Users\\Administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\x7nutq33.default\\extensions\\[email protected]";
FirefoxProfile profile = new FirefoxProfile();
profile.AddExtension(firebugPath);
Driver = new FirefoxDriver(profile);