Skip to content

Commit f3c0151

Browse files
authored
Merge pull request #444 from seleniumbase/settings-refactoring
Settings refactoring
2 parents 6b56be0 + 83d6149 commit f3c0151

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

examples/custom_settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
# If True and --proxy=IP_ADDRESS:PORT is invalid, then error immediately.
3131
RAISE_INVALID_PROXY_STRING_EXCEPTION = True
3232

33+
# Default browser resolutions when opening new windows for tests.
34+
# (Headless resolutions take priority, and include all browsers.)
35+
# (Firefox starts maximized by default when running in GUI Mode.)
36+
CHROME_START_WIDTH = 1250
37+
CHROME_START_HEIGHT = 840
38+
HEADLESS_START_WIDTH = 1440
39+
HEADLESS_START_HEIGHT = 1880
40+
3341
# Changing the default behavior of MasterQA Mode.
3442
MASTERQA_DEFAULT_VALIDATION_MESSAGE = "Does the page look good?"
3543
MASTERQA_WAIT_TIME_BEFORE_VERIFY = 0.5

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pymysql==0.9.3
3737
pyotp==2.3.0
3838
boto==2.49.0
3939
cffi>=1.13.2
40-
tqdm>=4.40.1
40+
tqdm>=4.40.2
4141
flake8==3.7.9
4242
certifi>=2019.11.28
4343
pdfminer.six==20191110

seleniumbase/config/proxy_list.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"""
2020

2121
PROXY_LIST = {
22-
"example1": "66.7.113.39:3128", # (Example) - set your own proxy here
23-
"example2": "104.236.248.219:3128", # (Example) - set your own proxy here
22+
"example1": "104.236.248.219:3128", # (Example) - set your own proxy here
23+
"example2": "165.227.102.37:3128", # (Example) - set your own proxy here
24+
"example3": "23.244.28.27:3128", # (Example) - set your own proxy here
2425
"proxy1": None,
2526
"proxy2": None,
2627
"proxy3": None,

seleniumbase/config/settings.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@
7777
# If True, the Content Security Policy will be disabled on Chrome.
7878
# If False, each website's default Content Security Policy will be used.
7979
# (A website's CSP may prevent SeleniumBase from loading custom JavaScript.)
80-
# If using demo_mode or MasterQA, this value will become True regardless,
81-
# with the exception of running in headless mode, in which case it'll be False.
8280
# You can also disable the CSP on the command line by using "--disable_csp".
8381
DISABLE_CSP_ON_CHROME = False
8482

@@ -87,6 +85,14 @@
8785
# (This applies when using --proxy=[PROXY_STRING] for using a proxy server.)
8886
RAISE_INVALID_PROXY_STRING_EXCEPTION = True
8987

88+
# Default browser resolutions when opening new windows for tests.
89+
# (Headless resolutions take priority, and include all browsers.)
90+
# (Firefox starts maximized by default when running in GUI Mode.)
91+
CHROME_START_WIDTH = 1250
92+
CHROME_START_HEIGHT = 840
93+
HEADLESS_START_WIDTH = 1440
94+
HEADLESS_START_HEIGHT = 1880
95+
9096
# #####>>>>>----- MasterQA SETTINGS -----<<<<<#####
9197
# ##### (Used when importing MasterQA as the parent class)
9298

seleniumbase/fixtures/base_case.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,8 +1457,10 @@ def get_new_driver(self, browser=None, headless=None,
14571457
self.driver = new_driver
14581458
if self.headless:
14591459
# Make sure the invisible browser window is big enough
1460+
width = settings.HEADLESS_START_WIDTH
1461+
height = settings.HEADLESS_START_HEIGHT
14601462
try:
1461-
self.set_window_size(1440, 1880)
1463+
self.set_window_size(width, height)
14621464
self.wait_for_ready_state_complete()
14631465
except Exception:
14641466
# This shouldn't fail, but in case it does,
@@ -1467,8 +1469,8 @@ def get_new_driver(self, browser=None, headless=None,
14671469
pass
14681470
else:
14691471
if self.browser == 'chrome':
1470-
width = 1250
1471-
height = 840
1472+
width = settings.CHROME_START_WIDTH
1473+
height = settings.CHROME_START_HEIGHT
14721474
try:
14731475
if self.maximize_option:
14741476
self.driver.maximize_window()
@@ -4198,10 +4200,12 @@ def setUp(self, masterqa_mode=False):
41984200
self.testcase_manager.insert_testcase_data(data_payload)
41994201
self.case_start_time = int(time.time() * 1000)
42004202
if self.headless:
4203+
width = settings.HEADLESS_START_WIDTH
4204+
height = settings.HEADLESS_START_HEIGHT
42014205
try:
42024206
# from pyvirtualdisplay import Display # Skip for own lib
42034207
from seleniumbase.virtual_display.display import Display
4204-
self.display = Display(visible=0, size=(1440, 1880))
4208+
self.display = Display(visible=0, size=(width, height))
42054209
self.display.start()
42064210
self.headless_active = True
42074211
except Exception:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.34.0',
48+
version='1.34.1',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',
@@ -120,7 +120,7 @@
120120
'pyotp==2.3.0',
121121
'boto==2.49.0',
122122
'cffi>=1.13.2',
123-
'tqdm>=4.40.1',
123+
'tqdm>=4.40.2',
124124
'flake8==3.7.9',
125125
'certifi>=2019.11.28',
126126
'pdfminer.six==20191110',

0 commit comments

Comments
 (0)