File tree Expand file tree Collapse file tree 1 file changed +31
-4
lines changed
source/python/gui/source/tests Expand file tree Collapse file tree 1 file changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -1518,10 +1518,37 @@ def test_parse_uploaded_file():
15181518
15191519def set_up (ip_addr = "localhost" , ip_port = "8051" ):
15201520 # works for linux, no browser pops up
1521- fireFoxOptions = webdriver .FirefoxOptions ()
1522- fireFoxOptions .add_argument ("--headless" )
1523- browser = webdriver .Firefox (options = fireFoxOptions )
1524- browser .get ("http://" + ip_addr + ":" + ip_port + "/" )
1521+ webdriver_keys = webdriver .__dict__ .keys ()
1522+ browser = None
1523+ exception_vals = []
1524+
1525+ if "Chrome" in webdriver_keys and "ChromeOptions" in webdriver_keys :
1526+ try :
1527+ chromiumOptions = webdriver .ChromeOptions ()
1528+ chromiumOptions .add_argument ("--headless" )
1529+ browser = webdriver .Chrome (options = chromiumOptions )
1530+ except Exception as e :
1531+ exception_vals .append (e )
1532+
1533+ if (
1534+ browser is None
1535+ and "Firefox" in webdriver_keys
1536+ and "FirefoxOptions" in webdriver_keys
1537+ ):
1538+ try :
1539+ fireFoxOptions = webdriver .FirefoxOptions ()
1540+ fireFoxOptions .add_argument ("--headless" )
1541+ browser = webdriver .Firefox (options = fireFoxOptions )
1542+ except Exception as e :
1543+ exception_vals .append (e )
1544+
1545+ if browser :
1546+ browser .get ("http://" + ip_addr + ":" + ip_port + "/" )
1547+ elif exception_vals :
1548+ for itr in exception_vals :
1549+ print (f"Exception: { itr } " )
1550+ raise exception_vals [0 ]
1551+
15251552 return browser
15261553
15271554
You can’t perform that action at this time.
0 commit comments