Package: page-object-elements
Page Object ElementsDist:pypi.orgInstallationpip install page-object-elementsAspect LoggerTo customize behaviour ofpoelogger,poe.inishould be in the root of project (or in some child dirs). If not
present or some of the values aren't set inpoe.ini(e.glogs_absolute_path) default values will be applied.poe.ini

[LOGGER]
level = DEBUG
log_name = log
stdout = True
logs_absolute_path = C:\Users\<username>\workspace\<project>Example of uselocators.py@aspect.logclassLetsCodeItLocators(object):# 1st sectionFIRST_SECTION=(By.XPATH,'//*[@id="page"]/div[2]/div[2]/div/div/div/div/div[1]')CAR_SELECT=(By.ID,'carselect')BMV_CB=(By.ID,'bmwcheck')# 2nd sectionSECOND_SECTION=(By.XPATH,'//*[@id="page"]/div[2]/div[2]/div/div/div/div/div[2]')SWITCH_TAB_EXAMPLE_LBL=(By.XPATH,'//legend[contains(text(), "Switch Tab Example")]')OPEN_TAB_BTN=(By.ID,'opentab')ENTER_YOUR_NAME_INPUT=(By.CSS_SELECTOR,'[placeholder="Enter Your Name"]')# 3rd sectionTHIRD_SECTION=(By.XPATH,'//*[@id="table-example-div"]')WEB_TABLE=(By.XPATH,'//tbody//tr')page.py@aspect.logclassFirstSection(SectionElement):car_select=SelectElement(LetsCodeItLocators.CAR_SELECT,True)bmw_cb=CheckBoxElement(locator=LetsCodeItLocators.BMV_CB,enabled_check=True)@aspect.logclassSecondSection(SectionElement):open_tab_btn=ScreenElement()switch_tab_example_lbl=LabelElement(locator=LetsCodeItLocators.SWITCH_TAB_EXAMPLE_LBL)enter_your_name_input=InputElement(locator=LetsCodeItLocators.ENTER_YOUR_NAME_INPUT)@aspect.logclassThirdSection(SectionElement):classRowModel(TableElement.TableRowModel):def__init__(self,container):super().__init__(container)@propertydefauthor(self):returnself.column_cell(1)@propertydefcourse(self):returnself.column_cell(2)@propertydefprice(self):returnself.column_cell(3)web_table=TableElement(LetsCodeItLocators.WEB_TABLE,RowModel)@aspect.logclassLetsCodeIt(BasePage):first_section=FirstSection(locator=LetsCodeItLocators.FIRST_SECTION)second_section=SecondSection(locator=LetsCodeItLocators.SECOND_SECTION)third_section=ThirdSection(locator=LetsCodeItLocators.THIRD_SECTION)defvisit(self):self.driver.get('https://courses.letskodeit.com/practice')test_letscodeid.pydeftest_letscodeit(chrome):page=LetsCodeIt(chrome)page.visit()'''LABEL'''label_text=page.second_section.switch_tab_example_lblprint(label_text)'''INPUT'''page.second_section.enter_your_name_input='LetsCodeIt''''SELECT'''page.first_section.car_select='Benz'print(page.first_section.car_select.text)print(page.first_section.car_select.enabled)print(page.first_section.car_select())'''CHECKBOX'''page.first_section.bmw_cb=Trueprint(page.first_section.bmw_cb.checked)print(page.first_section.bmw_cb.enabled)print(page.first_section.bmw_cb())'''TABLE'''web_table=page.third_section.web_table# print headersforrowinweb_table.headers:print(row.author.text,'\t|',row.course.text,'\t|',row.price.text)# print rowsforrowinweb_table.rows:print(row.author.text,'\t|',row.course.text,'\t|',row.price.text)# filter rows by specific valueforrowinweb_table.filter_rows_by('course','JavaScript Programming Language'):print(row.price.text)'''BUTTON'''page.second_section.open_tab_btn.set_locator(LetsCodeItLocators.OPEN_TAB_BTN)page.second_section.open_tab_btn.click()