Skip to content

Commit

Permalink
[py] add headless convenience method for Firefox Options
Browse files Browse the repository at this point in the history
  • Loading branch information
lmtierney committed Nov 16, 2017
1 parent a70ab21 commit 1d490b4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions py/selenium/webdriver/firefox/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,25 @@ def add_argument(self, argument):
raise ValueError()
self._arguments.append(argument)

@property
def headless(self):
"""
Returns whether or not the headless argument is set
"""
return '-headless' in self._arguments

def set_headless(self, headless=True):
"""
Sets the headless argument
Args:
headless: boolean value indicating to set the headless option
"""
if headless:
self._arguments.append('-headless')
elif '-headless' in self._arguments:
self._arguments.remove('-headless')

def to_capabilities(self):
"""Marshals the Firefox options to a `moz:firefoxOptions`
object.
Expand Down

0 comments on commit 1d490b4

Please sign in to comment.