示例#1
0
文件: dates_page.py 项目: vepam/JDI
class DatesPage(WebPage):
    def __init__(self, url, title):
        super(DatesPage, self).__init__(url=url, title=title)

    r_image_input = RFileInput(By.css("[data-provides=fileinput]"))

    uploaded_file_name = Link(By.css("[class=filename] span"))
示例#2
0
文件: frame_page.py 项目: zyme/JDI
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 »"))
示例#3
0
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)
示例#4
0
class EpamSite(WebSite):
    home_page = HomePage(url="/",
                         title="EPAM | Software Product Development Services")
    career_page = CareerPage(url="/careers", title="Careers")
    product_development_page = ProductDevelopmentPage(
        url="/solutions/core-engineering/product-development")
    job_listing_page = JobListingPage(
        url=
        "/careers/job-listings?sort=best_match&query=Engineer&department=Software+Test+Engineering&city=St-Petersburg&country=Russia",
        url_template="/careers/job-listings",
        title="Job Listings",
        url_check_type=CheckPageTypes.CONTAINS,
        title_check_type=CheckPageTypes.CONTAINS)
    job_description_page = None  #JobDescriptionPage(
    # url="/careers/job-listings/job.11584#apply", urlTemplate=".*/careers/job-listings/job\\.\\d*#apply",
    # urlCheckType=CheckPageTypes.MATCH)

    header_menu = Menu(by_all_options_names_locator=By.css(".tile-menu>li>a"),
                       parametrized_class=HeaderMenu)
    multiple_header_menu = Menu(by_menu_levels_locators=[
        By.css(".tile-menu>li>a"),
        By.xpath("//*[@class='tile-menu']//*[@href='/solutions']//..//li")
    ])

    line_menu = None  #JDIElements(By.css(".tile-menu>li>a"), Button)

    header_solutions_menu = None  #Menu(By.css(".tile-menu .submenu a"), HeaderSolutionsMenu)
示例#5
0
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"))
示例#6
0
class HomePage(WebPage):
    def __init__(self, url, title):
        super(HomePage, self).__init__(url=url, title=title)

    about = Link(By.link_text("About"))

    logo_image = Image(By.css(".epam-logo img"))

    text_item = Text(By.css(".main-txt"))
示例#7
0
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 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"))
示例#9
0
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"))
示例#10
0
文件: login.py 项目: zyme/JDI
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)
示例#11
0
class EpamJDISite(WebSite):

    #pages
    home_page = HomePage(url="/index.htm", title="Index Page")
    metals_colors_page = MetalColorPage(url="/page2.htm",
                                        title="Metal and Colors")
    contact_form_page = ContactFormPage(url="/page1.htm", title="Contact Form")
    support_page = SupportPage(url="/page3.htm", title="Support")
    dates_page = DatesPage(url="/page4.htm", title="Simple Table")

    #elements
    actions_log = TextList(By.css(".logs li"))

    #sections
    footer = Footer(By.css(".footer-content"))
    login_page = Login(By.css(".uui-profile-menu"))
示例#12
0
文件: add_cv_form.py 项目: zyme/JDI
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"))
示例#13
0
class Cell(SelectElement):
    row_index = None
    column_index = None
    table = None
    column_num = None
    row_nom = None
    web_element = None
    column_name = None
    row_name = None
    cell_locator_template = By.xpath(".//tr[{1}]/td[{0}]")

    def __init__(self,
                 column_num,
                 row_num,
                 col_name,
                 row_name,
                 table,
                 cell_locator_template=None,
                 web_element=None,
                 column_index=None,
                 row_index=None):
        if web_element is not None:
            self.web_element = web_element
        if cell_locator_template is not None:
            self.cell_locator_template = cell_locator_template
        if column_index is not None:
            self.column_index = column_index + 1 if table.rows.has_header and table.rows.by_line_template is None else column_index
        if row_index is not None:
            self.row_index = row_index

        self.column_num = column_num
        self.row_num = row_num
        self.col_name = col_name
        self.row_name = row_name
        self.table = table

    def set_web_element(self, web_element):
        self.web_element = web_element

    def update_data(self, col_name, row_name):
        if self.column_name is None or self.column_name == "" and not (
                col_name is None or col_name == ""):
            self.column_name = col_name
        if self.row_name is None and self.row_name == "" and not (
                row_name is None or row_name == ""):
            self.row_name = row_name
        return self

    def get_text_action(self):
        return self.get().get_text()

    def get(self):
        cell = SelectElement(web_element=self.web_element) if self.web_element is not None else \
            SelectElement(
                WebDriverByUtils.fill_by_template(self.cell_locator_template, [self.column_index, self.row_index]))
        cell.init(parent=self.table, avatar=cell.avatar)
        return cell
示例#14
0
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"))
示例#15
0
文件: jdi_paginator.py 项目: zyme/JDI
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"))
示例#16
0
class SupportPage(WebPage):
    def __init__(self, url, title):
        super(SupportPage, self).__init__(url=url, title=title)

    support_table = Table(by_table_locator=By.css(".uui-table"))
    support_table.rows.start_index = 1
示例#17
0
 def find(self, text):
     Button(By.css(".search>.icon-search")).click()
     super(JDISearch, self).find(text)
示例#18
0
class Table(Text):
    cache = True
    footer = list()
    by_cell_locator_template = None
    all_cells = list()
    columns = Columns()
    rows = Rows()
    by_footer_locator = By.xpath(".//tfoot/tr/th")

    def __init__(self,
                 by_table_locator=None,
                 by_column_header=None,
                 by_row_header=None,
                 by_row=None,
                 by_column=None,
                 row_start_index=None,
                 column_start_index=None,
                 by_cell_locator_template=None,
                 by_footer=None,
                 root=None):
        super(Table, self).__init__(by_locator=by_table_locator)

        self.columns.table = self
        self.rows.table = self

        if by_column is not None: self.columns.by_line_template = by_column
        if by_column_header is not None:
            self.columns.by_headers_locator = by_column_header
        if by_row is not None: self.rows.by_line_template = by_row
        if by_row_header is not None:
            self.rows.by_headers_locator = by_row_header

        if column_start_index is not None and column_start_index > -1:
            self.columns.start_index = column_start_index
        if row_start_index is not None and row_start_index > -1:
            self.rows.start_index = row_start_index

        self.by_cell_locator_template = by_cell_locator_template
        self.by_footer_locator = by_footer

    def get_text_action(self):
        return "||X||" + "|".join(self.columns.get_headers()) + "||" + "".join(
            list(
                map(
                    lambda rn: "\n||" + rn + "||" + "|".join(self.row_value(
                        rn)) + "||", self.rows.get_headers())))

    def row_value(self, row_name):
        return self.rows.get_row_value(row_name)

    def get_headers(self):
        return self.columns.get_headers()

    def is_empty(self):
        try:
            self.get_driver().implicitly_wait(0)
            row_count = self.rows.get_count(True)
            return row_count == 0
        finally:
            self.get_driver().implicitly_wait(
                JDISettings.get_current_timeout_sec())

    def column(self, val, row=None):
        if row is not None:
            column_cell = self.cell(value=val, row=row)
            col = None
            if column_cell is not None:
                num = column_cell.column_num
                col = self.columns.get_column(num)
            return col
        return self.columns.get_column(val)

    def cell(self, web_element=None, column=None, row=None, value=None):
        if None not in [web_element, column, row] and value is None:
            return self.add_cell(
                web_element,
                column.get(lambda name: self.columns.get_headers().index(name),
                           lambda num: num),
                row.get(lambda name: self.rows.get_headers().index(name),
                        lambda num: num),
                column.get(lambda name: name, lambda num: ""),
                row.get(lambda name: name, lambda num: ""))
        elif None not in [value, row] and web_element == column is None:
            row_num = self.rows.get_headers().index(
                row.name) + 1 if row.has_name() else row.num
            return list(
                filter(lambda x: x[1].get_value() == value,
                       self.rows.get_row(row_num)))[0][1]
        elif None not in [value, column] and web_element == row is None:
            col_index = self.columns.get_headers().index(
                column.name) + 1 if column.has_name() else column.num
            return list(
                filter(lambda x: x[1].get_value() == value,
                       self.columns.get_column(col_index)))[0][1]
        else:
            return None

    def add_cell(self, web_element, col_num, row_num, col_name, row_name):
        if web_element is not None:
            cells = list(
                filter(
                    lambda c: c.column_num == col_num and c.row_num == row_num,
                    self.all_cells))
            cell = cells[0] if len(cells) > 0 else None
            if cell is not None:
                cell.set_web_element(web_element)
                return cell.update_data(col_name, row_name)

            cell = Cell(web_element=web_element,
                        column_num=col_num,
                        row_num=row_num,
                        col_name=col_name,
                        row_name=row_name,
                        cell_locator_template=self.by_cell_locator_template,
                        table=self)
            if self.cache:
                self.all_cells.append(cell)
            return cell

    def row(self, val, column=None):
        if column is not None:
            row_cell = self.cell(value=val, column=column)
            return self.rows.get_row(
                row_cell.row_num) if row_cell is not None else None
        return self.rows.get_row(val)

    def get_rows(self, *col_name_values):
        if len(col_name_values) == 0:
            return ro
示例#19
0
 def get_text(self):
     return Text(By.css(".metals .filter-option")).get_text()
示例#20
0
class FrameSection(Section):
    label_button = Button(By.css("button"))
示例#21
0
class Footer(Section):
    about_link = Link(By.link_text("About"))
示例#22
0
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']"))
示例#23
0
class CareerPage(WebPage):
    def __init__(self, url, title):
        super(CareerPage, self).__init__(url=url, title=title)

    job_filter = JobFilter(By.css(".job-search-form-ui"))
    list_menu = None  # JDIElements(By.css(".tile-menu>li>a"), Label)
示例#24
0
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"))
示例#25
0
class Header(Section):
    image = Image(By.xpath('//img[@src="label/Logo_Epam_Color.svg"]'))
    search_section = JDISearch()
示例#26
0
 def __init__(self):
     self.has_header = False
     self.element_index = ElementIndexType.nums
     self.by_headers_locator = By.xpath(".//tr/td[1]")
     self.by_default_template = By.xpath(".//tr[%s]/td")
示例#27
0
 def find(self, text):
     Button(By.css(".search>.icon-search")).click()
     super(JDISearch, self).find(text)
示例#28
0
文件: summary.py 项目: zyme/JDI
class Summary(Section):
    odds_radio_buttons = RadioButtonsSummary(By.css("#odds-selector p"))

    odds_selector = SelectorSummary(By.css("#odds-selector p"))
示例#29
0
 def __init__(self):
     self.has_header = True
     self.element_index = ElementIndexType.nums
     self.by_headers_locator = By.xpath(".//th")
     self.by_default_template = By.xpath(".//tr/td[%s]")