Skip to content

Updates and more #915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ COPY examples /SeleniumBase/examples/
COPY integrations /SeleniumBase/integrations/
COPY requirements.txt /SeleniumBase/requirements.txt
COPY setup.py /SeleniumBase/setup.py
RUN find -name '*.pyc' -delete
RUN find -name __pycache__ -delete
RUN find . -name '*.pyc' -delete
RUN find . -name __pycache__ -delete
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install --upgrade setuptools-scm
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ The code above will leave your browser window open in case there's a failure. (i
--chrome # (Shortcut for "--browser=chrome". On by default.)
--edge # (Shortcut for "--browser=edge".)
--firefox # (Shortcut for "--browser=firefox".)
--ie # (Shortcut for "--browser=ie".)
--opera # (Shortcut for "--browser=opera".)
--safari # (Shortcut for "--browser=safari".)
--cap-file=FILE # (The web browser's desired capabilities to use.)
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Jinja2==3.0.1;python_version>="3.6"
click==8.0.1
readme-renderer==29.0
pymdown-extensions==8.2
importlib-metadata==4.0.1;python_version>="3.6"
importlib-metadata==4.5.0;python_version>="3.6"
lunr==0.5.8
nltk==3.6.2
mkdocs==1.1.2
Expand Down
4 changes: 2 additions & 2 deletions examples/migration/protractor/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
$ pytest --rs -v --guest
========================== test session starts ==========================
platform darwin -- Python 3.9.2, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
metadata: {'Python': '3.9.2', 'Platform': 'macOS-10.14.6-x86_64-i386-64bit', 'Packages': {'pytest': '6.2.3', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'html': '2.0.1', 'rerunfailures': '9.1.1', 'xdist': '2.2.1', 'metadata': '1.11.0', 'ordering': '0.6', 'forked': '1.3.0', 'seleniumbase': '1.62.0'}}
metadata: {'Python': '3.9.2', 'Platform': 'macOS-10.14.6-x86_64-i386-64bit', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'html': '2.0.1', 'rerunfailures': '10.0', 'xdist': '2.2.1', 'metadata': '1.11.0', 'ordering': '0.6', 'forked': '1.3.0', 'seleniumbase': '1.63.10'}}
rootdir: /Users/michael/github/SeleniumBase/examples, configfile: pytest.ini
plugins: html-2.0.1, rerunfailures-9.1.1, xdist-2.2.1, metadata-1.11.0, ordering-0.6, forked-1.3.0, seleniumbase-1.62.0
plugins: html-2.0.1, rerunfailures-10.0, xdist-2.2.1, metadata-1.11.0, ordering-0.6, forked-1.3.0, seleniumbase-1.63.10
collected 4 items

example_test.py::AngularJSHomePageTests::test_greet_user PASSED
Expand Down
6 changes: 3 additions & 3 deletions examples/migration/protractor/mat_paginator_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ describe('angular-material paginator component page', () => {
it('Should navigate to next page', async() => {
await $('button[aria-label=\'Next page\']').click();

await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('11 – 20 of 100');
await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('Page 2 of 10');
});

it('Should navigate to previous page', async() => {
await $('button[aria-label=\'Previous page\']').click();

await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('1 – 10 of 100');
await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('Page 1 of 10');
});

it('Should change list length to 5 items per page', async() => {
Expand All @@ -26,6 +26,6 @@ describe('angular-material paginator component page', () => {

await fiveItemsOption.click();

await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('1 – 5 of 100');
await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('Page 1 of 20');
});
});
6 changes: 3 additions & 3 deletions examples/migration/protractor/mat_paginator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ def test_pagination(self):
self.assert_element(".mat-button-wrapper > .mat-icon")
# Verify navigation to the next page
self.click('button[aria-label="Next page"]')
self.assert_exact_text("11 – 20 of 100", ".mat-paginator-range-label")
self.assert_exact_text("Page 2 of 10", ".mat-paginator-range-label")
# Verify navigation to the previous page
self.click('button[aria-label="Previous page"]')
self.assert_exact_text("1 – 10 of 100", ".mat-paginator-range-label")
self.assert_exact_text("Page 1 of 10", ".mat-paginator-range-label")
# Verify changed list length to 5 items per page
self.click("mat-select > div")
self.click("mat-option > .mat-option-text")
self.assert_exact_text("1 – 5 of 100", ".mat-paginator-range-label")
self.assert_exact_text("Page 1 of 20", ".mat-paginator-range-label")
1 change: 1 addition & 0 deletions help_docs/customizing_test_runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ SeleniumBase provides additional ``pytest`` command-line options for tests:
--chrome # (Shortcut for "--browser=chrome". On by default.)
--edge # (Shortcut for "--browser=edge".)
--firefox # (Shortcut for "--browser=firefox".)
--ie # (Shortcut for "--browser=ie".)
--opera # (Shortcut for "--browser=opera".)
--safari # (Shortcut for "--browser=safari".)
--cap-file=FILE # (The web browser's desired capabilities to use.)
Expand Down
14 changes: 9 additions & 5 deletions help_docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,35 @@

<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Installation</h2>

If installing SeleniumBase directly [from PyPI (the Python Package Index)](https://pypi.python.org/pypi/seleniumbase), use:
#### If installing SeleniumBase directly from [PyPI](https://pypi.python.org/pypi/seleniumbase), (the Python Package Index), use:

```bash
pip install seleniumbase
```

If installing SeleniumBase from a Git clone, use:
#### If installing SeleniumBase from a Git clone, use:

```bash
git clone https://github.com/seleniumbase/SeleniumBase.git
cd SeleniumBase/
pip install .
```

For a development mode install in editable mode, use:
#### For a development mode install in editable mode, use:

```bash
git clone https://github.com/seleniumbase/SeleniumBase.git
cd SeleniumBase/
pip install -e .
```

If installing SeleniumBase [from a GitHub branch](https://github.com/seleniumbase/SeleniumBase), use:
#### If installing SeleniumBase from a [GitHub branch](https://github.com/seleniumbase/SeleniumBase), use:

```bash
pip install git+https://github.com/seleniumbase/SeleniumBase.git@master#egg=seleniumbase
```

Useful ``pip`` options include:
#### Useful ``pip`` options include:
* Add ``--upgrade`` OR ``-U`` to upgrade an installation.
* Add ``--force-reinstall`` for a clean install.

Expand Down
16 changes: 9 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@ wheel>=0.36.2
attrs>=21.2.0
PyYAML>=5.4.1;python_version>="3.6"
sortedcontainers==2.4.0
certifi>=2020.12.5
certifi>=2021.5.30
six==1.16.0
nose==1.3.7
ipdb==0.13.4;python_version<"3.6"
ipdb==0.13.7;python_version>="3.6"
ipdb==0.13.9;python_version>="3.6"
parso==0.7.1;python_version<"3.6"
parso==0.8.2;python_version>="3.6"
jedi==0.17.2;python_version<"3.6"
jedi==0.18.0;python_version>="3.6"
idna==2.10
chardet==3.0.4;python_version<"3.6"
chardet==4.0.0;python_version>="3.6"
urllib3==1.26.4
urllib3==1.26.5
requests==2.25.1
selenium==3.141.0
msedge-selenium-tools==3.141.3
more-itertools==5.0.0;python_version<"3.5"
more-itertools==8.8.0;python_version>="3.5"
cssselect==1.1.0
filelock==3.0.12
fasteners==0.16
fasteners==0.16;python_version<"3.6"
fasteners==0.16.1;python_version>="3.6"
pluggy==0.13.1
py==1.8.1;python_version<"3.5"
py==1.10.0;python_version>="3.5"
Expand All @@ -45,7 +46,8 @@ pytest-metadata==1.8.0;python_version<"3.6"
pytest-metadata==1.11.0;python_version>="3.6"
pytest-ordering==0.6
pytest-rerunfailures==8.0;python_version<"3.5"
pytest-rerunfailures==9.1.1;python_version>="3.5"
pytest-rerunfailures==9.1.1;python_version>="3.5" and python_version<"3.6"
pytest-rerunfailures==10.0;python_version>="3.6"
pytest-xdist==1.34.0;python_version<"3.5"
pytest-xdist==2.2.1;python_version>="3.5"
parameterized==0.8.1
Expand All @@ -69,7 +71,7 @@ decorator==5.0.9;python_version>="3.5"
ipython==5.10.0;python_version<"3.5"
ipython==6.5.0;python_version>="3.5" and python_version<"3.6"
ipython==7.16.1;python_version>="3.6" and python_version<"3.7"
ipython==7.23.1;python_version>="3.7"
ipython==7.24.1;python_version>="3.7"
matplotlib-inline==0.1.2;python_version>="3.7"
colorama==0.4.4
pathlib2==2.3.5;python_version<"3.5"
Expand All @@ -94,7 +96,7 @@ pdfminer.six==20201018;python_version>="3.5"
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)

coverage==5.5
pytest-cov==2.12.0
pytest-cov==2.12.1
flake8==3.7.9;python_version<"3.5"
flake8==3.9.2;python_version>="3.5"
pyflakes==2.1.1;python_version<"3.5"
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "1.63.9"
__version__ = "1.63.10"
98 changes: 98 additions & 0 deletions seleniumbase/console_scripts/sb_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def main(override=None):
sys.argv = ["seleniumbase", "install", "edgedriver"]
elif override == "geckodriver":
sys.argv = ["seleniumbase", "install", "geckodriver"]
elif override == "iedriver":
sys.argv = ["seleniumbase", "install", "iedriver"]

num_args = len(sys.argv)
if (
Expand All @@ -108,6 +110,9 @@ def main(override=None):

file_name = None
download_url = None
headless_ie_url = None
headless_ie_exists = False
headless_ie_file_name = None
downloads_folder = DRIVER_DIR
sys_plat = sys.platform
expected_contents = None
Expand Down Expand Up @@ -336,6 +341,19 @@ def main(override=None):
"https://selenium-release.storage.googleapis.com/"
"%s/%s" % (major_version, file_name)
)
headless_ie_version = "v1.4"
headless_ie_file_name = "headless-selenium-for-win-v1-4.zip"
headless_ie_url = (
"https://github.com/kybu/headless-selenium-for-win/"
"releases/download/"
"%s/%s" % (headless_ie_version, headless_ie_file_name)
)
url_request = requests.get(headless_ie_url)
if url_request.ok:
headless_ie_exists = True
msg = c2 + "HeadlessIEDriver version for download" + cr
p_version = c3 + headless_ie_version + cr
print("\n*** %s = %s" % (msg, p_version))
elif name == "operadriver" or name == "operachromiumdriver":
name = "operadriver"
use_version = DEFAULT_OPERADRIVER_VERSION
Expand Down Expand Up @@ -411,6 +429,86 @@ def main(override=None):
if not os.path.exists(downloads_folder):
os.mkdir(downloads_folder)

if headless_ie_exists:
headless_ie_file_path = downloads_folder + "/" + headless_ie_file_name
print(
"\nDownloading %s from:\n%s ..."
% (headless_ie_file_name, headless_ie_url)
)
remote_file = requests.get(headless_ie_url)
with open(headless_ie_file_path, "wb") as file:
file.write(remote_file.content)
print("Download Complete!\n")
zip_file_path = headless_ie_file_path
zip_ref = zipfile.ZipFile(zip_file_path, "r")
contents = zip_ref.namelist()
h_ie_fn = headless_ie_file_name.split(".zip")[0]
expected_contents = [
"%s/" % h_ie_fn,
"%s/ruby_example/" % h_ie_fn,
"%s/ruby_example/Gemfile" % h_ie_fn,
"%s/ruby_example/Gemfile.lock" % h_ie_fn,
"%s/ruby_example/ruby_example.rb" % h_ie_fn,
"%s/desktop_utils.exe" % h_ie_fn,
"%s/headless_ie_selenium.exe" % h_ie_fn,
"%s/README.md" % h_ie_fn,
]
if len(contents) > 8:
raise Exception("Unexpected content in HeadlessIEDriver Zip file!")
for content in contents:
if content not in expected_contents:
raise Exception(
"Expected file [%s] missing from [%s]"
% (content, expected_contents)
)
# Zip file is valid. Proceed.
driver_path = None
driver_file = None
filename = None
for f_name in contents:
# Remove existing version if exists
str_name = str(f_name)
new_file = downloads_folder + "/" + str_name
if str_name == "%s/headless_ie_selenium.exe" % h_ie_fn:
driver_file = str_name
driver_path = new_file
filename = "headless_ie_selenium.exe"
if os.path.exists(new_file):
os.remove(new_file)
if not driver_file or not driver_path or not filename:
raise Exception("headless_ie_selenium.exe missing from Zip file!")
print("Extracting %s from %s ..." % (filename, headless_ie_file_name))
zip_ref.extractall(downloads_folder)
zip_ref.close()
os.remove(zip_file_path)
shutil.copyfile(driver_path, "%s/%s" % (downloads_folder, filename))
print("Unzip Complete!\n")
to_remove = [
"%s/%s/ruby_example/Gemfile" % (downloads_folder, h_ie_fn),
"%s/%s/ruby_example/Gemfile.lock" % (downloads_folder, h_ie_fn),
"%s/%s/ruby_example/ruby_example.rb" % (downloads_folder, h_ie_fn),
"%s/%s/desktop_utils.exe" % (downloads_folder, h_ie_fn),
"%s/%s/headless_ie_selenium.exe" % (downloads_folder, h_ie_fn),
"%s/%s/README.md" % (downloads_folder, h_ie_fn),
]
for file_to_remove in to_remove:
if os.path.exists(file_to_remove):
os.remove(file_to_remove)
if os.path.exists("%s/%s/ruby_example/" % (downloads_folder, h_ie_fn)):
# Only works if the directory is empty
os.rmdir("%s/%s/ruby_example/" % (downloads_folder, h_ie_fn))
if os.path.exists("%s/%s/" % (downloads_folder, h_ie_fn)):
# Only works if the directory is empty
os.rmdir("%s/%s/" % (downloads_folder, h_ie_fn))
driver_path = "%s/%s" % (downloads_folder, filename)
print(
"The file [%s] was saved to:\n%s%s%s\n"
% (filename, c3, driver_path, cr)
)
print("Making [%s %s] executable ..." % (driver_file, use_version))
make_executable(driver_path)
print("%s[%s] is now ready for use!%s" % (c1, driver_file, cr))

print("\nDownloading %s from:\n%s ..." % (file_name, download_url))
remote_file = requests.get(download_url)
with open(file_path, "wb") as file:
Expand Down
Loading