Skip to content

healenium/healenium-example-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Example with Healenium

Docker Pulls License

Python 3.9.5 + Pytest project with healenium usage example

1. Start Healenium components

2. Configuration RemoteWebDriver for Healenium

3. Run test

4. Monitoring tests running

How to start

1. Start Healenium components

Go into healenium folder

cd healenium

Run Healenium with Selenium-Grid:

docker-compose up -d

Run Healenium with Selenoid

Note: browsers.json consists of target browsers and appropriate versions. Before run healenium you have to manually pull selenoid browser docker images with version specified in browsers.json

Example pull selenoid chrome image:

docker pull selenoid/vnc:chrome_111.0

Full list of browser images you can find here

Run healenium with Selenoid:

docker-compose -f docker-compose-selenoid.yaml up -d

ATTENTION

Verify the next images are Up and Running

  • postgres-db (PostgreSQL database to store etalon selector / healing / report)
  • hlm-proxy (Proxy client request to Selenium server)
  • hlm-backend (CRUD service)
  • selector imitator (Convert healed locator to convenient format)
  • selenoid/selenium-grid (Selenium server)

2. Configuration RemoteWebDriver for Healenium

To run using Healenium create RemoteWebDriver with URL http://<remote webdriver host>:8085:

        options = webdriver.ChromeOptions()
        self.driver = webdriver.Remote('http://localhost:8085', options=options)

To temporarily disable the healing mechanism for certain sections of your code, use the following syntax:

        self.driver.execute_script("disable_healing_true")
        ... // Your code that does not require healing
        self.driver.execute_script("disable_healing_false")

3. Run test

To run tests in terminal with pytest you need to go to execute next commands:

python3 -m venv env
source ./env/bin/activate
python -m pip install -U pytest
python -m pip install -U selenium
pytest

If you want to execute tests from specified file, please use the command: python -m pytest ./tests/test_css.py

In case you want to run all tests in project use python -m pytest ./tests/ command

4. Monitoring tests running

You can monitor tests running if you using Healenium with Selenoid plus Selenoid Ui, go to:

http://localhost:8080

Community / Support

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published