Pyleniumio

Latest version: v1.21.0

Safety actively analyzes 663882 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

1.12.3

Overview

`.select()` and `.select_many()` worked pretty well as expected. However, they wouldn't fail as expected! Because we were trying to combine all the "select strategies" in a single function, it made it harder to test and debug _and_ hid some exceptions... like when an `<option>` didn't exist... whoops!

Now, each strategy has been pulled out into its own method and positive and negative tests have been added to make sure it works 😉

* `.select_by_index(index: int)`
* `.select_by_text(text: str)`
* `.select_by_value(value)`

Changes

* New `.select_by_*()` methods exist on the `Element` object. Just remember that the dropdowns have to be a `<select>` element!
* `.select()` and `.select_many()` still exist, but show a `DEPRECATED` warning. We will be removing them in a future release
* Our docs have a new home! We are still using GitBook, but we now have the official `docs.pylenium.io` domain! Check it out 😄

1.12.2

Overview

Microsoft's Edge Browser can be used on Macs now, but we hadn't tested it locally on a Mac before. One of our amazing users did and they found a bug! This should now be fixed 😄

Fixes

Removed `options` from `webdriver_factory.build_edge()` since it isn't needed and was causing the `MicrosoftEdgeDriver` to raise an error.

Contributors

For anyone looking to contribute, we have changed using `pipenv` as our package manager to `poetry`.

* You can find out more about `poetry` by visiting their website: [https://python-poetry.org](https://python-poetry.org)
* You can see how to setup your machine for Python Development with `poetry` with my [Video on YouTube](https://youtu.be/547Jr26duHQ)

1.11.0

Overview

Pylenium can now do Accessibility \(a11y\) Testing and Audits using aXe! Easily generate JSON reports to share and export or write assertions against it directly in your tests.

Added

aXe integration

There are two ways to start using aXe in your tests:

* `PyleniumAxe` class from `pylenium.a11y` module
* `axe` fixture \(recommended\)

python
def test_axe_fixture(py, axe):
py.visit('https://qap.dev')
save the axe report as a file
report = axe.run(name='a11y_audit.json')
and/or use the report directly in the test(s)
assert len(report.violations) == 0


In the above example, we are using Pylenium to navigate to the website and then `axe` to run the audit, generate the report, and check that we have zero violations!

iframes

The main change here is the ability to drag and drop within iframes. Pylenium uses jQuery to perform this action, but we need to inject jQuery if the page doesn't already have it. However, in V1 of our jQuery implementation, it would only inject into the main document and not within each iframe. This is now fixed!

* Pylenium's jQuery V2 now comes in its own module and injects into all iframes of the page
* `py.switch_to` now comes with a `py.switch_to.frame_by_element()` which is useful when the iframe does not have an `id` or `name` attribute

python
iframe = py.get('iframe')
py.switch_to.frame_by_element(iframe)

1.10.0

Overview

Pylenium can now gather Web Performance metrics right from the browser and into your hands! Through Pylenium's Performance API, you can leverage the different Performance and Timing objects that each browser tracks and generates. Also, we have created some custom data points, like `Time to Interactive`, `Page Load Time`, and `Time to First Contentful Paint`!

Added

* Performance API

python
Access the Performance API right from py
perf = py.performance.get()


* WindowPerformance Object

The main abstraction that holds all of these metrics and data points.

python
get the TTI
tti = py.performance.get().time_to_interactive()


* Stopwatch Decorator

The `performance.py` module includes a Stopwatch Decorator that you add to any function. This will log how long it takes for that function to complete!

python
1. How long does it take to add an item to the cart?
stopwatch
def add_item_to_cart(py):
py.get('add-item').click()
py.get('added-notification').should().be_visible()

2. How long does it take to edit an item's available stock via the API and see it change in the UI?
stopwatch
def update_available_stock(py, item, quantity):
payload = {'item': item, 'qty': quantity}
api.items.update(payload)
py.get(f'available-stock-{item}').should().have_text(quantity)


* CONTRIBUTING.md
* CODE\_OF\_CONDUCT.md

Linked Issues

[Gather Web Performance data and log how long actions take](https://app.gitkraken.com/glo/view/card/c08c640de7754a2f9cd68034ffbd93a4)

1.9.7

Added

* Github Actions CI to Pylenium repo
* Pylenium CLI: `pylenium version` is now `pylenium --version`

If you want to import the `Pylenium` class into a Module, you used to do this:

python
from pylenium import Pylenium


This has now been changed \(for CI reasons\) to:

python
from pylenium.driver import Pylenium


So make sure you update this import statement if you were using the previous version!

Fixes

* pytest version 6.1.0 \(released in September 2020\) causes issues within Pylenium's conftest.py. Changed Pipfile to use previous version until a solution is found
* `is_checked()` now works for Radio Buttons and Checkboxes

1.9.0

> Changes were made to the `conftest.py` file, so make sure to run `pylenium init -c` after upgrading to `1.9.0` to overwrite it with the latest. Not doing this will likely result in `ModuleNotFoundErrors`

Report Portal \(RP\)

RP is now natively supported by Pylenium! If you are not already familiar with Report Portal, I highly suggest you check it out. It gives you robust reporting and categorizing of your test runs and results and is backed with machine learning! [https://reportportal.io](https://reportportal.io)

We had very basic logging and reporting, but we wanted to provide a better and more robust reporting solution. After a lot of research, we landed on RP. They are not only free and Open Source, but they also have a great community, Slack group, and YouTube channel with different demos and presentations to help you take your reporting to the next level. This level of modern support was crucial in our decision and we hope you enjoy it!

**Added**

* `pylenium init` now also creates a default `pytest.ini` file at your Project Root. This contains values to easily connect with RP.
* `pylenium portal` [CLI Commands](cli/report-portal.md) to quickly setup your RP instance

bash
1. Download the docker-compose file used to spin up RP
pylenium portal download

2. Configure your machine and this docker-compose.yml based on your OS and needs
by going to https://reportportal.io/docs/Deploy-with-Docker


bash
3. Spin up the RP instance
pylenium portal up


That's it! You'll get helpful hints as you execute each command so you know where to go and how to login. Happy reporting!

**Fixes**

* `get_xpath` and `find_xpath` functions were not behaving as expected. This has been fixed, but we have also renamed them to
* `getx()`
* `findx()`
* `AttributeError` was raised if there were more than one `pytest_runtest_makereport` fixtures in the project.
* Logging now uses the built-in `logging` python package, but screenshots are still saved to the `test_results` directory.

Page 1 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.