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 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 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 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 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 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"))
def __init__(self, by_locator=None, web_element=None): TextField.__init__(by_locator, web_element)
def get_text_field(self): text_files = TextField(self.get_locator()) text_files.set_parent(self.get_parent()) return text_files