Reputation: 58908
install_addon
is a method on the Firefox webdriver, but I'm running tests remotely. How can I install an add-on to a driver like the following:
driver = webdriver.Remote(
command_executor=SELENIUM_URL,
desired_capabilities=webdriver.DesiredCapabilities.FIREFOX
)
? It looks like creating a webdriver.FirefoxProfile()
and using add_extension()
should work, but it's currently broken.
The use case is testing the effect of Firefox add-on manifest.json's all_frames
property.
Upvotes: 1
Views: 325
Reputation: 11
Аfter a long search and visits on this topic from google i found solution
Install addon in you Firefox profile from browser, save it and set him into webdriver options.
firefox
browserabout:profiles
about:profiles
in Root Directory
section)from selenium.webdriver import FirefoxOptions, FirefoxProfile, Remote
# init options object
options = FirefoxOptions()
# init profile object with path to you profile
profile = FirefoxProfile('{path_to_your_profile_folder}')
# set profile into options
options.profile = profile
# init you Remote browser with created options (commented arguments for example)
driver = Remote(
options=options,
# command_executor= ...,
# desired_capabilities=...
)
It`s works for me. The disadvantage of this solution is the presence of a folder with a profile that needs to be stored somewhere
Upvotes: 1