Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from selenium import webdriver
2from selenium.webdriver.firefox.options import Options
3from . import Base
6class Firefox(Base):
7 def get_options(self):
8 return Options()
10 def boot_driver(self):
11 return webdriver.Firefox(**self.browser_args)
13 def do_install_addon(self, params):
14 """
15 - name: install local addons
16 install_addon:
17 install: /path/to/addon.xpi
18 register: addon_id
19 - name: uninstall addon
20 install_addon:
21 uninstall: "{{addon_id}}"
22 """
23 to_uninstall = params.get("uninstall", [])
24 if isinstance(to_uninstall, (tuple, list)):
25 for i in to_uninstall:
26 self.driver.uninstall_addon(i)
27 else:
28 self.driver.uninstall_addon(to_uninstall)
29 to_install = params.get("install", [])
30 if isinstance(to_install, (tuple, list)):
31 res = []
32 for i in to_install:
33 res.append(self.driver.install_addon(i))
34 return res
35 else:
36 return self.driver.install_addon(to_install)