Skip to main content

Selenium page object implementation

Project description

About this
==========

This is page object implementation for selenium library.

How to use
==========

1. Basic usage

```python
from pagium import Page, PageElement, By, Remote


class GooglePage(Page):

search = PageElement(by=By.NAME, value='q')


wd = Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'},
)

with GooglePage(wd, 'https://google.com') as page:
page.search.send_keys(*'python selenium')
```

2. Controls usage

```python
from pagium import Page, PageElement, WebElement, By, Remote, Keys


class SearchInput(WebElement):

def fill(self, text):
self.send_keys(*text + Keys.ENTER)


class GooglePage(Page):

search = PageElement(SearchInput, by=By.NAME, value='q')


wd = Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'},
)

with GooglePage(wd, 'https://google.com') as page:
page.search.fill('python selenium')
```

3. Container usage

```python
from pagium import Page, PageElement, WebElement, By, Remote, Keys


class SearchInput(WebElement):

def fill(self, text):
self.send_keys(*text + Keys.ENTER)


class SearchForm(WebElement):

input = PageElement(SearchInput, by=By.NAME, value='q')


class GooglePage(Page):

search_form = PageElement(SearchForm)


wd = Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'},
)

with GooglePage(wd, 'https://google.com') as page:
page.search_form.input('python selenium')
```

4. Web driver polling

Pagium has feature polling for web drivers

```python
wd = Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'},
polling_timeout=20,
polling_delay=0.5,
)
```

Polling timeout is retry time for a while execute command raise error and delay is sleep time between reties.

It make using like

```python
wd = Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'},
)

with wd.enable_polling(20, delay=0.1):
...
```

or

```python
wd = Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'},
polling_timeout=20,
polling_delay=0.5,
)

with wd.disable_polling():
...
```

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

pagium-0.0.3.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file pagium-0.0.3.tar.gz.

File metadata

  • Download URL: pagium-0.0.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for pagium-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e27c7e205fc2a971bc62ddaf1a202a5a62c79aac3bcb3ae9e116c761a1db3032
MD5 13515d5b6af6fa0de7e57b591925f53a
BLAKE2b-256 fec4cc4cdd1be1fd6fde2a3c9c9dda0e41e373722a0ac31056889c98e89f7041

See more details on using hashes here.

Supported by

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