Skip to main content

A lightweight wrapper around Selenium python repo.

Project description

A lightweight wrapper around Selenium Python.
It's a simple extension to standard Selenium. The Philosophy is "Use standard Selenium, when it works, and use additional methods, when Selenium annoys, mainly with waits".

Short Features Overview:

  • It is easy integrated with your existing Selenium code and
  • It is compatible with any standard Selenium methods.
    For instance:
# Your Selenium code
browser = webdriver.Chrome()
browser.get("https://www.seleniumhq.org/")

# with `selen-kaa`
from se_wrapper.browser_driver import BrowserDriver

browser = BrowserDriver(webdriver.Chrome())
browser.get("https://www.seleniumhq.org/")
# any methods from the WebDriver works!
element = browser.find_element_by_css(".test-class")

Besides standard Selenium, selen-kaa introduces more convenient way to interact with a web page and web elements through init_web_element() and init_web_elements():

  • you can freely create the web element in __init__(), as the WebDriver would search this element only at the time of interaction with it:
browser = BrowserDriver(webdriver.Chrome())

class MyPage:

    def __init__():
        # lazy creation of a web element
        self.element1 = browser.init_web_element("#test")
    
page = MyPage()
# even if `self.element1` has not been rendered yet on the web page, 
# it's safe, you would have no NoSuchElementException
browser.get("www.some.com")
page.element1.click() # WebDriver would `find_element` and click it only on this step

init_web_element() returns SeWebElement object, which has attributes of standard WebElement but with additional logic of lazy initialization, custom waits and conditions. init_web_elements() returns SeElementsArray - a collection of SeWebElement objects with the same lazy initialization logic.

element1 = browser.init_web_element("#test")
element1.should.be_visible(timeout=4) # wait 4 seconds until element becomes visible

elements = browser.init_web_elements(".test-class")
elements[0].should.have_exact_text(text="first element", timeout=4)

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

selen-kaa-0.0.3.1.0.tar.gz (10.9 kB view details)

Uploaded Source

File details

Details for the file selen-kaa-0.0.3.1.0.tar.gz.

File metadata

  • Download URL: selen-kaa-0.0.3.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.15+

File hashes

Hashes for selen-kaa-0.0.3.1.0.tar.gz
Algorithm Hash digest
SHA256 81a49929626dada1eb06fb2a8ae9fca412459a3123f4115bcc77df39ff73f716
MD5 c0ee65381d967c8aabfe60663e8608d9
BLAKE2b-256 9853362ad1562ab19edd0aca00409bec05ea81d7876d4a511f0a828463a6177b

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