Skip to content

Commit 5ad7a8c

Browse files
authored
Merge pull request #936 from seleniumbase/a-few-updates
Some updates to driver downloads and loading external JS resources
2 parents 4c40d60 + c0c4bcf commit 5ad7a8c

File tree

13 files changed

+133
-74
lines changed

13 files changed

+133
-74
lines changed

Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,18 @@ RUN pip3 install --upgrade setuptools
8484
RUN pip3 install --upgrade setuptools-scm
8585
RUN cd /SeleniumBase && ls && pip3 install -r requirements.txt --upgrade
8686
RUN cd /SeleniumBase && python3 setup.py develop
87-
RUN seleniumbase install chromedriver
88-
RUN seleniumbase install geckodriver
87+
88+
#=====================
89+
# Download WebDrivers
90+
#=====================
91+
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.29.1/geckodriver-v0.29.1-linux32.tar.gz
92+
RUN tar -xvzf geckodriver-v0.29.1-linux32.tar.gz
93+
RUN chmod +x geckodriver
94+
RUN mv geckodriver /usr/local/bin/
95+
RUN wget https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip
96+
RUN unzip chromedriver_linux64.zip
97+
RUN mv chromedriver /usr/local/bin/
98+
RUN chmod +x /usr/bin/chromedriver
8999

90100
#==========================================
91101
# Create entrypoint and grab example tests

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ joblib==1.0.1;python_version>="3.6"
55
Markdown==3.3.4;python_version>="3.6"
66
MarkupSafe==2.0.1;python_version>="3.6"
77
docutils==0.17.1
8+
pkginfo==1.7.1;python_version>="3.6"
89
Jinja2==3.0.1;python_version>="3.6"
910
click==8.0.1;python_version>="3.6"
1011
zipp==3.5.0;python_version>="3.6"

examples/parameterized_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class GoogleTests(BaseCase):
66
@parameterized.expand(
77
[
88
["PyPI", "pypi.org", 'img[alt="PyPI"]'],
9-
["Wikipedia", "wikipedia.org", "img.central-featured-logo"],
9+
["Wikipedia", "www.wikipedia.org", "img.central-featured-logo"],
1010
["SeleniumBase", "seleniumbase/SeleniumBase", 'img[title*="Sel"]'],
1111
]
1212
)

help_docs/method_summary.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,11 @@ self.press_left_arrow(selector="html", times=1, by=By.CSS_SELECTOR)
258258

259259
self.press_right_arrow(selector="html", times=1, by=By.CSS_SELECTOR)
260260

261-
self.scroll_to(selector, by=By.CSS_SELECTOR)
261+
self.scroll_to(selector, by=By.CSS_SELECTOR, timeout=None)
262+
# Duplicates: self.scroll_to_element(selector, by=By.CSS_SELECTOR)
262263

263-
self.slow_scroll_to(selector, by=By.CSS_SELECTOR)
264+
self.slow_scroll_to(selector, by=By.CSS_SELECTOR, timeout=None)
265+
# Duplicates: self.slow_scroll_to_element(selector, by=By.CSS_SELECTOR)
264266

265267
self.scroll_to_top()
266268

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ pymysql==0.10.1;python_version<"3.6"
8484
pymysql==1.0.2;python_version>="3.6"
8585
pyotp==2.6.0
8686
boto==2.49.0
87-
cffi==1.14.5
87+
cffi==1.14.6
8888
toml==0.10.2
8989
Pillow==6.2.2;python_version<"3.5"
9090
Pillow==7.2.0;python_version>="3.5" and python_version<"3.6"
91-
Pillow==8.3.0;python_version>="3.6"
91+
Pillow==8.3.1;python_version>="3.6"
9292
rich==10.5.0;python_version>="3.6" and python_version<"4.0"
9393
tornado==5.1.1;python_version<"3.5"
9494
tornado==6.1;python_version>="3.5"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "1.63.14"
2+
__version__ = "1.63.15"

seleniumbase/console_scripts/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ def show_install_usage():
120120
print(" sbase install chromedriver")
121121
print(" sbase install geckodriver")
122122
print(" sbase install edgedriver")
123-
print(" sbase install chromedriver 89")
124-
print(" sbase install chromedriver 89.0.4389.23")
123+
print(" sbase install chromedriver 91")
124+
print(" sbase install chromedriver 91.0.4472.101")
125125
print(" sbase install chromedriver latest")
126126
print(" sbase install chromedriver -p")
127127
print(" sbase install chromedriver latest -p")
128-
print(" sbase install edgedriver 89.0.774.54")
128+
print(" sbase install edgedriver 91.0.864.67")
129129
print(" Output:")
130130
print(" Installs the chosen webdriver to seleniumbase/drivers/")
131131
print(" (chromedriver is required for Chrome automation)")

seleniumbase/console_scripts/sb_install.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
sbase install chromedriver
1414
sbase install geckodriver
1515
sbase install edgedriver
16-
sbase install chromedriver 89.0.4389.23
17-
sbase install chromedriver 89
16+
sbase install chromedriver 91.0.4472.101
17+
sbase install chromedriver 91
1818
sbase install chromedriver latest
1919
sbase install chromedriver -p
2020
sbase install chromedriver latest -p
21-
sbase install edgedriver 89.0.774.54
21+
sbase install edgedriver 91.0.864.67
2222
Output:
2323
Installs the chosen webdriver to seleniumbase/drivers/
2424
(chromedriver is required for Chrome automation)
@@ -85,6 +85,17 @@ def make_executable(file_path):
8585
os.chmod(file_path, mode)
8686

8787

88+
def requests_get(url):
89+
response = None
90+
try:
91+
response = requests.get(url)
92+
except Exception:
93+
# Prevent SSLCertVerificationError / CERTIFICATE_VERIFY_FAILED
94+
url = url.replace("https://", "http://")
95+
response = requests.get(url)
96+
return response
97+
98+
8899
def main(override=None):
89100
if override == "chromedriver":
90101
sys.argv = ["seleniumbase", "install", "chromedriver"]
@@ -163,22 +174,24 @@ def main(override=None):
163174
file_name = "chromedriver_linux64.zip"
164175
elif "win32" in sys_plat or "win64" in sys_plat or "x64" in sys_plat:
165176
file_name = "chromedriver_win32.zip" # Works for win32 / win_x64
177+
if not get_latest and not get_v_latest and num_args < 4:
178+
get_latest = True
166179
else:
167180
raise Exception(
168181
"Cannot determine which version of chromedriver to download!"
169182
)
170183
found_chromedriver = False
171184
if get_latest:
172-
url_request = requests.get(last)
185+
url_request = requests_get(last)
173186
if url_request.ok:
174187
found_chromedriver = True
175188
use_version = url_request.text
176189
elif get_v_latest:
177-
url_req = requests.get(last)
190+
url_req = requests_get(last)
178191
if url_req.ok:
179192
latest_version = url_req.text
180193
last = last + "_" + use_version
181-
url_request = requests.get(last)
194+
url_request = requests_get(last)
182195
if url_request.ok:
183196
found_chromedriver = True
184197
use_version = url_request.text
@@ -190,12 +203,12 @@ def main(override=None):
190203
)
191204
url_request = None
192205
if not found_chromedriver:
193-
url_req = requests.get(last)
206+
url_req = requests_get(last)
194207
if url_req.ok:
195208
latest_version = url_req.text
196209
if use_version == latest_version:
197210
get_latest = True
198-
url_request = requests.get(download_url)
211+
url_request = requests_get(download_url)
199212
if found_chromedriver or url_request.ok:
200213
p_version = use_version
201214
p_version = c3 + use_version + cr
@@ -226,7 +239,7 @@ def main(override=None):
226239
"https://api.github.com/repos/"
227240
"mozilla/geckodriver/releases/latest"
228241
)
229-
url_request = requests.get(last)
242+
url_request = requests_get(last)
230243
if url_request.ok:
231244
found_geckodriver = True
232245
use_version = url_request.json()["tag_name"]
@@ -260,7 +273,7 @@ def main(override=None):
260273
)
261274
url_request = None
262275
if not found_geckodriver:
263-
url_request = requests.get(download_url)
276+
url_request = requests_get(download_url)
264277
if found_geckodriver or url_request.ok:
265278
msg = c2 + "geckodriver version for download" + cr
266279
p_version = c3 + use_version + cr

seleniumbase/core/tour_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def is_introjs_activated(driver):
192192

193193
def activate_shepherd(driver):
194194
"""Allows you to use Shepherd Tours with SeleniumBase
195-
http://github.hubspot.com/shepherd/docs/welcome/
195+
https://cdnjs.com/libraries/shepherd/1.8.1
196196
"""
197197
shepherd_js = constants.Shepherd.MIN_JS
198198
sh_theme_arrows_css = constants.Shepherd.THEME_ARROWS_CSS

seleniumbase/fixtures/base_case.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,6 +2948,9 @@ def scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None):
29482948
)
29492949
self.__scroll_to_element(element, selector, by)
29502950

2951+
def scroll_to_element(self, selector, by=By.CSS_SELECTOR, timeout=None):
2952+
self.scroll_to(selector, by=by, timeout=timeout)
2953+
29512954
def slow_scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None):
29522955
""" Slow motion scroll to destination """
29532956
self.__check_scope()
@@ -2975,6 +2978,11 @@ def slow_scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None):
29752978
)
29762979
self.__slow_scroll_to_element(element)
29772980

2981+
def slow_scroll_to_element(
2982+
self, selector, by=By.CSS_SELECTOR, timeout=None
2983+
):
2984+
self.slow_scroll_to(selector, by=by, timeout=timeout)
2985+
29782986
def scroll_to_top(self):
29792987
""" Scroll to the top of the page. """
29802988
self.__check_scope()

0 commit comments

Comments
 (0)