class AddCVForm(Form): first_name = TextField(By.css("[placeholder='First Name']")) last_name = TextField(By.css("[placeholder='Last Name']")) email = TextField(By.css("[placeholder='Email']")) country = Dropdown( root=By.css(".country-wrapper"), by_select_locator=By.css(".arrow"), by_option_locator_template=By.xpath( "*root*//*[contains(@id,'select-box-applicantCountry')]//li[.='%s']" ), ) city = Dropdown( root=By.css(".country-wrapper"), by_select_locator=By.css(".arrow"), by_option_locator_all=By.xpath( "*root*//*[contains(@id,'select-box-applicantCity')]//li"), ) cv = RFileInput(By.css(".file-upload")) comment = TextArea(By.xpath(".comment-input")) submut = Button(By.xpath("//*[.='Submit']")) cancel = Button(By.xpath("//*[.='Cancel']"))
class ContactFormTwoButtons(Form): def __init__(self, by_locator=None): super(ContactFormTwoButtons, 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']")) calculate = Button(By.xpath("//*[text()='Calculate']")) def get_form_value(self): return {self.first_name.get_text(), self.last_name.get_text(), self.description.get_text()}
class JDISearch(Search): search_input = TextField(By.css(".search-field input")) search_button = Button(By.css(".search .search-active .icon-search")) def find(self, text): Button(By.css(".search>.icon-search")).click() super(JDISearch, self).find(text)
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 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 JobFilter(Form): keyword = TextField(By.css(".job-search-input")) category = Dropdown(root=By.css(".multi-select-department"), by_select_locator=By.css(".multi-select-filter"), by_option_locator_all=By.css(".blue-checkbox-label")) location = TreeDropdown( By.css(".career-location-box"), [By.css(".location-dropdown .optgroup"), By.xpath("//..//li")]) select_button = Button(By.css(".job-search-button")) label = Label(By.css(".job-search-title"))
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"))
def find(self, text): Button(By.css(".search>.icon-search")).click() super(JDISearch, self).find(text)
def get_find_button(self): find_button = Button(self.get_locator()) find_button.set_parent(self.get_parent()) return find_button
def __init__(self, by_locator=None, by_select_locator=None, by_suggestions_list_locator=None): super(Search, self).__init__(by_locator) self.find_button_button = Button(by_select_locator) self.suggestions = TextList(by_suggestions_list_locator)
class FrameSection(Section): label_button = Button(By.css("button"))
class JDIPagination(Pagination): next_button = Button(By.css("[class=next] a")) previous_button = Button(By.css("[class=prev] a")) first_button = Button(By.css("[class=first] a")) last_button = Button(By.css("[class=last] a")) page = Button(By.css(".uui-pagination li"))