Skip to content

Commit

Permalink
Fix firefox initialization error using Selenium 2.X
Browse files Browse the repository at this point in the history
  • Loading branch information
rgonalo committed Mar 23, 2017
1 parent 576563e commit 9290d3f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Toolium Changelog
=================

v1.2.5
------

*In development*

- Fix firefox initialization error using Selenium 2.X

v1.2.4
------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.4
1.2.5-dev
10 changes: 8 additions & 2 deletions toolium/config_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,14 @@ def _setup_firefox(self, capabilities):
firefox_options = None

log_path = os.path.join(DriverWrappersPool.output_directory, 'geckodriver.log')
return webdriver.Firefox(firefox_profile=self._create_firefox_profile(), capabilities=capabilities,
executable_path=gecko_driver, firefox_options=firefox_options, log_path=log_path)
try:
# Selenium 3
return webdriver.Firefox(firefox_profile=self._create_firefox_profile(), capabilities=capabilities,
executable_path=gecko_driver, firefox_options=firefox_options, log_path=log_path)
except TypeError:
# Selenium 2
return webdriver.Firefox(firefox_profile=self._create_firefox_profile(), capabilities=capabilities,
executable_path=gecko_driver, firefox_options=firefox_options)

def _create_firefox_profile(self):
"""Create and configure a firefox profile
Expand Down

0 comments on commit 9290d3f

Please sign in to comment.