Skip to content

Web element control

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

Simple usage

from pagium import Page, PageElement, By, controls

class MyPage(Page):
    my_input = PageElement(controls.Input, by=By.NAME, value='name')

with MyPage(wd, 'http://project') as page:
    page.my_input.fill('input value')

controls.Input

  • value property return input value
  • fill method fill input fill('text')

controls.Link

  • href property return link href

controls.Image

  • src property return image src

controls.Select

  • options property return list of select options
  • selected property return selected option or None if no one selected
  • select method select option by value or text select('value_or_text', by='value')

controls.Checkbox

  • is_checked method return True if checkbox is checked or False is_checked()
  • check method check checkbox if not checked check()
  • uncheck method uncheck checkbox if checked uncheck()

Custom control

from pagium import Page, PageElement, WebElement, By

class MyCustomControl(WebElement):
    pass

class MyPage(Page):
    my_input = PageElement(MyCustomControl, by=By.NAME, value='name')

Clone this wiki locally