import allure from src.ui_elements.base_ui_element import BaseUIElement class InputUIElement(BaseUIElement): def send_text(self, text): with allure.step("sending text {} to an input".format(text)): self.log.info(f"sending text {text} to an input of {self.locator[1]}") self._element.click() self._element.send_keys(text) def send_password(self, text): with allure.step("sending password to an input"): self._element.click() self._element.send_keys(text) @allure.step("Clicking on {0}") def click(self): self.log.info(f"Clicking on {self.locator[1]}") self.wait() self._element.click() @allure.step("Clearing {0}") def clear_text(self): self.log.info(f"clearing text of {self.locator[1]}") self._element.clear() @property @allure.step("Getting text of {0}") def text(self): self.log.info(f"Getting text of {self.locator[1]}") text = self._element.text if not text: text = self._element.get_attribute("innerText") return text.strip() def __str__(self): return f"Input {self.name}"