class ContactFormPage(WebPage): def __init__(self, url, title): super(ContactFormPage, self).__init__(url=url, title=title) description = TextArea(By.id("Description")) name_text_field = TextField(By.id("Name"))
class ContactForm(Form): def __init__(self, by_locator=None): super(ContactForm, self).__init__(by_locator) first_name = TextField(By.id("Name")) last_name = TextField(By.id("LastName")) description = TextArea(By.id("Description")) submit = Button(By.xpath("//*[text()='Submit']")) def get_form_value(self): return {self.first_name.get_text(), self.last_name.get_text(), self.description.get_text()}
class Login(Form): login = TextField(By.id("Login")) password = TextField(By.id("Password")) button = Button(By.css(".btn-login")) profile = Clickable(By.css(".profile-photo")) def submit(self, user): Login.profile.click() super(Login, self).submit_form(user)
class MetalColorPage(WebPage): def __init__(self, url, title): super(MetalColorPage, self).__init__(url=url, title=title) calculate_button = Button(By.id("calculate-button")) cb_water = CheckBoxMetalColor( By.xpath("//*[@id='elements-checklist']//*[text()='Water']")) calculate_label = Label(By.id("calculate-button")) nature_check_list = CheckListMetalColor( By.css("#elements-checklist label"))
class ContactFormPage(WebPage): def __init__(self, url, title): super(ContactFormPage, self).__init__(url=url, title=title) description = TextArea(By.id("Description")) name_text_field = TextField(By.id("Name")) contact_form = ContactForm(By.css("main form")) contact_form_two_buttons = ContactFormTwoButtons(By.css("main form")) result = TextArea(By.css(".results"))
class FramePage(WebPage): def __init__(self, url, title=None, domain=None): super(FramePage, self).__init__(url, title, domain) i_frame = FrameSection(By.id("iframeResult")) try_it_button = Button(By.link_text("Try it Yourself »"))
class MetalColorPage(WebPage): def __init__(self, url, title): super(MetalColorPage, self).__init__(url=url, title=title) calculate_button = Button(By.id("calculate-button")) cb_water = CheckBoxMetalColor(By.xpath("//*[@id='elements-checklist']//*[text()='Water']")) calculate_label = Label(By.id("calculate-button")) nature_check_list = CheckListMetalColor(By.css("#elements-checklist label")) combo_box = ComboBoxMetalColor(select_locator=By.css(".metals .caret"), options_names_locator_template=By.css(".metals li span"), value_locator=By.css(".metals input")) color_dropdown = Dropdown(By.css(".colors .filter-option"), By.css(".colors li span")) summary = Summary(By.id("summary-block"))
class JobDescriptionPage(WebPage): def __init__(self, url, title): super(JobDescriptionPage, self).__init__(url=url, title=title) add_cv_form = AddCVForm(By.css(".form-constructor")) captcha = Element(By.id("captcha-input"))