Skip to content

Commit 6934f19

Browse files
authored
Merge pull request #717 from seleniumbase/refactoring-and-other-updates
Refactoring and other updates
2 parents 2e401b8 + fc0841c commit 6934f19

File tree

10 files changed

+71
-25
lines changed

10 files changed

+71
-25
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ pip install -e . # Editable install
111111
___/ / __/ / __/ / / / / /_/ / / / / / / /_) / (_/ /__ / __/
112112
/____/\___/_/\___/_/ /_/_/\__,_/_/ /_/ /_/_____/\__,_/____/\___/
113113
-----------------------------------------------------------------
114-
[seleniumbase <VERSION> (<PATH>)]
115114
116115
* USAGE: "seleniumbase [COMMAND] [PARAMETERS]"
117116
* OR: "sbase [COMMAND] [PARAMETERS]"

docs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
regex>=2020.10.11
1+
regex>=2020.9.27
22
tqdm>=4.50.2
33
livereload==2.6.3;python_version>="3.6"
4-
Markdown==3.3
4+
Markdown==3.3.1
55
readme-renderer==27.0
66
pymdown-extensions==8.0.1
77
mkdocs==1.1.2

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
python -m easy_install --upgrade pip
2+
python -m pip --upgrade pip
33
pip install -e . --upgrade --no-cache-dir --progress-bar off
44
seleniumbase install chromedriver
55
seleniumbase install geckodriver

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ pygments==2.7.1;python_version>="3.5"
4747
traitlets==4.3.3;python_version<"3.7"
4848
traitlets==5.0.4;python_version>="3.7"
4949
prompt-toolkit==1.0.18;python_version<"3.6"
50-
prompt-toolkit==3.0.7;python_version>="3.6"
50+
prompt-toolkit==3.0.8;python_version>="3.6"
5151
ipython==5.10.0;python_version<"3.5"
5252
ipython==6.5.0;python_version>="3.5" and python_version<"3.6"
5353
ipython==7.16.1;python_version>="3.6" and python_version<"3.7"
5454
ipython==7.18.1;python_version>="3.7"
55-
colorama==0.4.3
55+
colorama==0.4.4
5656
pathlib2==2.3.5;python_version<"3.5"
5757
importlib-metadata==2.0.0
58-
virtualenv>=20.0.33
58+
virtualenv>=20.0.34
5959
pymysql==0.10.1
6060
coverage==5.3
6161
brython==3.9.0

seleniumbase/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from seleniumbase.__version__ import __version__ # noqa
12
from seleniumbase.fixtures.base_case import BaseCase # noqa
23
from seleniumbase.masterqa.master_qa import MasterQA # noqa
34
from seleniumbase.common import decorators # noqa

seleniumbase/__version__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# seleniumbase package
2+
__version__ = "1.49.27"

seleniumbase/console_scripts/run.py

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ def show_usage():
5050

5151

5252
def show_basic_usage():
53+
import time
5354
from seleniumbase.console_scripts import logo_helper
5455
seleniumbase_logo = logo_helper.get_seleniumbase_logo()
5556
print(seleniumbase_logo)
56-
print("%s" % get_version()[0:1])
57-
print("")
57+
time.sleep(0.25) # Enough time to see the logo
58+
print()
59+
show_package_location()
60+
show_version_info()
61+
print()
5862
sc = ("")
5963
sc += (' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n')
6064
sc += (' * OR: "sbase [COMMAND] [PARAMETERS]"\n')
@@ -431,19 +435,39 @@ def show_grid_node_usage():
431435
print("")
432436

433437

434-
def get_version():
435-
import pkg_resources
438+
def get_version_info():
439+
# from pkg_resources import get_distribution
440+
# version = get_distribution("seleniumbase").version
441+
from seleniumbase import __version__
436442
version_info = None
437-
try:
438-
version_info = pkg_resources.require("seleniumbase")[0:1]
439-
except Exception:
440-
version_info = ["ERROR: Cannot detect version! Please reinstall!"]
443+
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
444+
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
445+
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
446+
cr = colorama.Style.RESET_ALL
447+
sb_text = c1 + "selenium" + c2 + "base" + cr
448+
version_info = "%s %s%s%s" % (sb_text, c3, __version__, cr)
441449
return version_info
442450

443451

444452
def show_version_info():
445-
version = get_version()
446-
print('\n%s\n' % version)
453+
version_info = get_version_info()
454+
print('%s' % version_info)
455+
456+
457+
def get_package_location():
458+
# from pkg_resources import get_distribution
459+
# location = get_distribution("seleniumbase").location
460+
import os
461+
import seleniumbase
462+
location = os.path.dirname(os.path.realpath(seleniumbase.__file__))
463+
if location.endswith("seleniumbase"):
464+
location = location[0:-len("seleniumbase")]
465+
return location
466+
467+
468+
def show_package_location():
469+
location = get_package_location()
470+
print("%s" % location)
447471

448472

449473
def show_options():
@@ -666,7 +690,13 @@ def main():
666690
show_grid_node_usage()
667691
elif command == "version" or command == "--version":
668692
if len(command_args) == 0:
693+
from seleniumbase.console_scripts import logo_helper
694+
seleniumbase_logo = logo_helper.get_seleniumbase_logo()
695+
print(seleniumbase_logo)
696+
print()
697+
show_package_location()
669698
show_version_info()
699+
print()
670700
else:
671701
show_basic_usage()
672702
elif command == "options" or command == "--options":

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6090,7 +6090,11 @@ def __scroll_to_element(self, element, selector=None, by=By.CSS_SELECTOR):
60906090
self.__demo_mode_pause_if_active(tiny=True)
60916091

60926092
def __slow_scroll_to_element(self, element):
6093-
js_utils.slow_scroll_to_element(self.driver, element, self.browser)
6093+
try:
6094+
js_utils.slow_scroll_to_element(self.driver, element, self.browser)
6095+
except Exception:
6096+
# Scroll to the element instantly if the slow scroll fails
6097+
js_utils.scroll_to_element(self.driver, element)
60946098

60956099
def __highlight_with_assert_success(
60966100
self, message, selector, by=By.CSS_SELECTOR):

setup.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import sys
99

1010

11-
this_directory = os.path.abspath(os.path.dirname(__file__))
11+
this_dir = os.path.abspath(os.path.dirname(__file__))
1212
long_description = None
1313
total_description = None
1414
try:
15-
with open(os.path.join(this_directory, 'README.md'), 'rb') as f:
15+
with open(os.path.join(this_dir, 'README.md'), 'rb') as f:
1616
total_description = f.read().decode('utf-8')
1717
description_lines = total_description.split('\n')
1818
long_description_lines = []
@@ -22,6 +22,11 @@
2222
long_description = "\n".join(long_description_lines)
2323
except IOError:
2424
long_description = 'Reliable Browser Automation & Testing Framework'
25+
about = {}
26+
# Get the package version from the seleniumbase/__version__.py file
27+
with open(os.path.join(
28+
this_dir, 'seleniumbase', '__version__.py'), 'rb') as f:
29+
exec(f.read().decode('utf-8'), about)
2530

2631
if sys.argv[-1] == 'publish':
2732
reply = None
@@ -54,7 +59,7 @@
5459

5560
setup(
5661
name='seleniumbase',
57-
version='1.49.26',
62+
version=about['__version__'],
5863
description='A complete framework for Web-UI testing | seleniumbase.io',
5964
long_description=long_description,
6065
long_description_content_type='text/markdown',
@@ -66,6 +71,10 @@
6671
license="MIT",
6772
classifiers=[
6873
"Development Status :: 5 - Production/Stable",
74+
"Environment :: Console",
75+
"Environment :: MacOS X",
76+
"Environment :: Win32 (MS Windows)",
77+
"Environment :: Web Environment",
6978
"Framework :: Pytest",
7079
"Intended Audience :: Developers",
7180
"Intended Audience :: Information Technology",
@@ -91,6 +100,7 @@
91100
"Topic :: Software Development :: Testing :: Traffic Generation",
92101
"Topic :: Utilities",
93102
],
103+
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
94104
install_requires=[
95105
'pip>=20.2.3',
96106
'packaging>=20.4',
@@ -142,14 +152,14 @@
142152
'traitlets==5.0.4;python_version>="3.7"',
143153
'ipython==5.10.0;python_version<"3.5"',
144154
'prompt-toolkit==1.0.18;python_version<"3.6"',
145-
'prompt-toolkit==3.0.7;python_version>="3.6"',
155+
'prompt-toolkit==3.0.8;python_version>="3.6"',
146156
'ipython==6.5.0;python_version>="3.5" and python_version<"3.6"',
147157
'ipython==7.16.1;python_version>="3.6" and python_version<"3.7"',
148158
'ipython==7.18.1;python_version>="3.7"',
149-
'colorama==0.4.3',
159+
'colorama==0.4.4',
150160
'pathlib2==2.3.5;python_version<"3.5"', # Sync with "virtualenv"
151161
'importlib-metadata==2.0.0', # Sync with "virtualenv"
152-
'virtualenv>=20.0.33', # Sync with importlib-metadata and pathlib2
162+
'virtualenv>=20.0.34', # Sync with importlib-metadata and pathlib2
153163
'pymysql==0.10.1',
154164
'coverage==5.3',
155165
'brython==3.9.0',

win_install.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@ECHO OFF
2-
python -m easy_install --upgrade pip
2+
py -m pip --upgrade pip
33
pip install -e . --upgrade --no-cache-dir --progress-bar off
44
seleniumbase install chromedriver
55
seleniumbase install geckodriver

0 commit comments

Comments
 (0)