简体   繁体   中英

Load a profile of Firefox in python selenium

In ruby I can load a certain profile of FireFox like this:

profile = Selenium::WebDriver::Firefox::Profile.from_name 'MyProfile'
b = Watir::Browser.new :firefox, :profile => profile
b.goto 'http://192.168.0.1'

How can I do that in Python? As far as I know, in Python it's not supported http://selenium-python.readthedocs.org/api.html

In Python, you can load a specific profile by path :

from selenium import webdriver

profile = webdriver.FirefoxProfile(profile_directory="path/to/profile")
driver = webdriver.Firefox(firefox_profile=profile)

Just put the name of the profile. It'll automatically load from the default location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM