Skip to main content

Selenium wrapper for Python

Project description

Selench

Selench is a wrapper that simplifies the use of the Selenium library. It provides a more concise syntax that makes the code more readable and easier to understand.

Key Features

  • Concise syntax
  • Less imports
  • Elements have an explicit wait time by default
  • Simple expected_conditions implementation as expect
  • Element type detection ( CSS & XPATH )

Installation

To install the library, use pip:

pip install selench

Alternatively, install the latest directly from the GitHub repository:

pip install git+https://github.com/dsymbol/selench.git

Examples

Navigate to DuckDuckGo and search for 'Hello World!'

from selench import Selench, Keys

driver = Selench()
driver.get('https://duckduckgo.com')
driver.element('[name=q]').send_keys('Hello World!', Keys.ENTER)
driver.quit()

Using PyTest: navigate to DuckDuckGo and search for 'github' assert titles contain 'github'

from selench import Selench, Keys
import pytest

@pytest.fixture
def driver():
    driver = Selench()
    yield driver
    driver.quit()

def test_ddg_search_query(driver):
    keyword = 'github'
    driver.get('https://duckduckgo.com/')
    driver.element('[name=q]').send_keys(keyword, Keys.ENTER)
    driver.expect.title_to_contain(keyword)
    titles = driver.elements('a[data-testid=result-title-a] span')

    for title in titles:
        assert keyword in title.text.lower()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selench-2024.5.2.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

selench-2024.5.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file selench-2024.5.2.tar.gz.

File metadata

  • Download URL: selench-2024.5.2.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for selench-2024.5.2.tar.gz
Algorithm Hash digest
SHA256 50d2afefddbb0637f2e5661ca2afd1b2b2072f9d776aa21c78c48b237b17c44c
MD5 192ce13db694c170ab6889ae3be18ece
BLAKE2b-256 1a560a11053847e18285f0f4e7a9a407b199bffcdd1510d352c698b6817512ff

See more details on using hashes here.

File details

Details for the file selench-2024.5.2-py3-none-any.whl.

File metadata

  • Download URL: selench-2024.5.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for selench-2024.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d9e97710a5509f48dfd166a3ab89ce7b11cb73b88af20ab7c6a1e84b20064ad
MD5 5220908ea351ac1d16d765904f9cbf6c
BLAKE2b-256 6faebd106e1c72cdb49aa11e3f818009adfb7963e3c7985de2210a55b937590c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page