Skip to content

healenium/healenium-selector-imitator

Repository files navigation

Healenium selector imitator

Selector imitator tries to reconstruct a user selector, changing only fields that the user modified in HTML. It works with the original selector (and its type) and target node (so it should be applied after the best node is already found). It proposes possible healed selectors or raises an error.
Proposed selectors are not guaranteed to find a unique web element. Uniqueness must be checked outside of the service with a selenium driver.

  1. Example request and response
  2. Image and container resources consumption
  3. Installation with Docker
  4. Creating your own image from Dockerfile
  5. Local testing

Here is an example request. You can try out different requests with Swagger after the installation. image image

image
image

Run the following command to install and use Healenium selector imitator as a stand-alone service (you'll need docker installed):

docker compose up

Now you can access an API at http://localhost:8000/
Check http://localhost:8000/docs for Swagger documentation.

If you wish to make some changes to the code and test them in Docker environment, you will need to create an image. Run these commands from the repository directory, change the version if needed (you'll need docker and pyarmor installed):

pyarmor obfuscate --platform linux.x86_64.7 --recursive --output dist/src src/__init__.py
pyarmor obfuscate --platform linux.x86_64.7 --exact app.py
docker build -t healenium/hlm-selector-imitator:1 .
docker run -d -p 8000:8000 healenium/hlm-selector-imitator:1

To test or lint locally, create a virtual environment with Pyhton 3.7 and install packages from requirements_dev.txt

Test with pytest:

pytest

Get coverage report:

coverage run -m pytest
coverage report -m
coverage html

Check types with mypy:

mypy src app.py

Lint with flake8:

flake8

Format code with black:

black .

About

Imitating user selectors structure when healing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published