6 from osx_browser_driver import OSXBrowserDriver
7 from selenium import webdriver
8 from selenium.webdriver.firefox.options import Options
11 _log = logging.getLogger(__name__)
13 args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
14 firefox_options = Options()
17 class OSXFirefoxDriver(OSXBrowserDriver):
18 process_name = 'firefox'
19 browser_name = 'firefox'
20 app_name = 'Firefox.app'
22 def launch_url(self, url, options, browser_build_path):
23 args_with_url = self._insert_url(args, 0, url)
24 self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
26 def launch_driver(self, url, options, browser_build_path):
27 if browser_build_path:
28 app_path = os.path.join(browser_build_path, self.app_name)
29 binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
30 firefox_options.binary_location = binary_path
31 driver_executable = self.webdriver_binary_path
32 driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
33 self._launch_webdriver(url=url, driver=driver)
37 class OSXFirefoxNightlyDriver(OSXBrowserDriver):
38 process_name = 'firefox'
39 browser_name = 'firefox-nightly'
40 app_name = 'FirefoxNightly.app'
42 def launch_url(self, url, options, browser_build_path):
43 args_with_url = self._insert_url(args, 0, url)
44 self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
46 def launch_driver(self, url, options, browser_build_path):
47 if not browser_build_path:
48 browser_build_path = '/Applications/'
49 app_path = os.path.join(browser_build_path, self.app_name)
50 binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
51 firefox_options.binary_location = binary_path
52 driver_executable = self.webdriver_binary_path
53 driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
54 self._launch_webdriver(url=url, driver=driver)