Skip to content

Page usage

Mikhail Trifonov edited this page Jun 4, 2019 · 2 revisions

Simple usage

from pagium import Page

page = Page(wd, 'http://project-host')
page.open()

wd is web driver instance

URL path

You can relate page class to URL path and use base project URL when instance to create. In example will be opened http://project-host/url/path/here

from pagium import Page

class MyPage(Page):
    __path__ = '/url/path/here'

page = MyPage(wd, 'http://project-host')
page.open()

URL path params

In example will be opened http://project-host/url/path/here

from pagium import Page

class MyPage(Page):
    __path__ = '/url/{param1}/{param2}'

page = MyPage(wd, 'http://project-host', path={'param1': 'path', 'param2': 'here'})
page.open()

Context manager

In this case will be called open and close methods of page class

from pagium import Page

with Page(wd, 'http://project-host') as page:
    pass

Clone this wiki locally