def get_post_reactions_lines(driver: RemoteWebDriver): """ :rtype: list of WebElement """ if check_exists_by_xpath(driver, XPATH_PAGE_POST_REACTIONS): return driver.find_elements_by_xpath(XPATH_PAGE_POST_REACTIONS)
def get_container(driver: RemoteWebDriver) -> WebElement: """ Funcao para obter container do post :param driver: RemoteWebDriver :return: WebElement """ if check_exists_by_xpath(driver, XPATH_POST_CONTAINER): return driver.find_element_by_xpath(XPATH_POST_CONTAINER)
def get_post_reactions_lines_collumns(element: WebElement): """ :rtype: list of WebElement """ if check_exists_by_xpath(element, XPATH_PAGE_POST_REACTIONS_COLS): return element.find_elements_by_xpath(XPATH_PAGE_POST_REACTIONS_COLS)
def __input_login(): """ Funcao para preencher o input de login. :return: Login """ if check_exists_by_xpath(Login.get_web_driver(), XPATH_INPUT_LOGIN): Login.get_web_driver().find_element_by_xpath( XPATH_INPUT_LOGIN).send_keys(Login.get_login()) return Login
def __submit(): """ Funcao para realizar submit/login :return: Login """ if check_exists_by_xpath(Login.get_web_driver(), XPATH_INPUT_SUBMIT): Login.get_web_driver().find_element_by_xpath( XPATH_INPUT_SUBMIT).click() return Login
def __input_password(): """ Funcao para preencher o input de senha. :return: Login """ if check_exists_by_xpath(Login.get_web_driver(), XPATH_INPUT_PASSWORD): Login.get_web_driver().find_element_by_xpath( XPATH_INPUT_PASSWORD).send_keys(Login.get_password()) return Login
def get_post_text_html(driver: RemoteWebDriver) -> WebElement: """ Funcao para obter div com o HTML do texto da postagem. :param driver: RemoteWebDriver :return: WebElement """ post_text_box = PostElements.get_post_text_box(driver) if check_exists_by_xpath(post_text_box, XPATH_POST_CONTAINER_TOP_DATA_TEXT_HTML): return post_text_box.find_element_by_xpath(XPATH_POST_CONTAINER_TOP_DATA_TEXT_HTML)
def get_post_text_box(driver: RemoteWebDriver) -> WebElement: """ Funcao para obter div com texto do post :param driver: RemoteWebDriver :return: WebElement """ post_data = PostElements.get_post_data(driver) if check_exists_by_xpath(post_data, XPATH_POST_CONTAINER_TOP_DATA_TEXT): return post_data.find_element_by_xpath(XPATH_POST_CONTAINER_TOP_DATA_TEXT)
def get_post_data(driver: RemoteWebDriver) -> WebElement: """ Obtem div com dados do post :param driver: RemoteWebDriver :return: WebElement """ container_top = PostElements.get_container_top(driver) if check_exists_by_xpath(container_top, XPATH_POST_CONTAINER_TOP_DATA): return container_top.find_element_by_xpath(XPATH_POST_CONTAINER_TOP_DATA)
def get_container_top(driver: RemoteWebDriver) -> WebElement: """ Funcao para obter o topo do container do post :param driver: RemoteWebDriver :return: WebElement """ container = PostElements.get_container(driver=driver) if check_exists_by_xpath(container, XPATH_POST_CONTAINER_TOP): return container.find_element_by_xpath(XPATH_POST_CONTAINER_TOP)
def get_post_video(driver: RemoteWebDriver) -> WebElement: """ Funcao para obter o video de uma postagem :param driver: RemoteWebDriver :return: WebElement """ post_data = PostElements.get_post_data(driver) if check_exists_by_xpath(post_data, XPATH_POST_CONTAINER_TOP_DATA_VIDEO): return post_data.find_element_by_xpath(XPATH_POST_CONTAINER_TOP_DATA_VIDEO)
def __is_logged() -> bool: """ Funcao para verificar se o usuario esta logado :return: bool """ return check_exists_by_xpath(Login.__web_driver, XPATH_SEARCH)