Add option to disable headless mode
This commit is contained in:
parent
07da641a12
commit
e24ef80272
15
main.py
15
main.py
@ -14,7 +14,7 @@ from selenium.webdriver.support.ui import WebDriverWait
|
||||
|
||||
|
||||
class BaseTester:
|
||||
def __init__(self, user: str, passwd: str, dev: bool):
|
||||
def __init__(self, user: str, passwd: str, dev: bool, show_browser: bool):
|
||||
self.user = user
|
||||
self.passwd = passwd
|
||||
if dev:
|
||||
@ -23,7 +23,7 @@ class BaseTester:
|
||||
self.base_url = "https://crm.caat.org.uk"
|
||||
|
||||
firefox_options = webdriver.FirefoxOptions()
|
||||
firefox_options.headless = True
|
||||
firefox_options.headless = not show_browser
|
||||
self.browser = webdriver.Firefox(options=firefox_options)
|
||||
self.wait = WebDriverWait(self.browser, 20)
|
||||
|
||||
@ -170,6 +170,13 @@ if __name__ == "__main__":
|
||||
action="store_true",
|
||||
help="Test dev site instead of production"
|
||||
)
|
||||
parser.set_defaults(dev=False)
|
||||
parser.add_argument(
|
||||
"--show_browser",
|
||||
"-s",
|
||||
dest="show_browser",
|
||||
action="store_true",
|
||||
help="Show the web browser"
|
||||
)
|
||||
parser.set_defaults(dev=False, show_browser=False)
|
||||
arguments = parser.parse_args()
|
||||
ContactExport(arguments.user, arguments.passwd, arguments.dev).test("John")
|
||||
ContactExport(arguments.user, arguments.passwd, arguments.dev, arguments.show_browser).test("John")
|
||||
|
Loading…
Reference in New Issue
Block a user