示例#1
0
def _is_page_not_reachable(browser: Browser) -> bool:
    """Returns `True` if web page is not reachable due to
    networking issue otherwise `False`.

    Args:
        browser: a current browser session
    """
    try:
        return WebElement.find(browser).by_class("neterror").is_displayed()
    except NoSuchElementException:
        return False
示例#2
0
 def send_message(self, message: str) -> None:
     WebElement.find(self._browser).by_class("js-message").set(message,
                                                               clear=True)
     WebElement.find(self._browser).by_class("js-send-message").click()
     self._match().wait_for_disappear(2)
     WebElement.find(
         self._browser).by_class("confirmation").wait_for_disappear(2)
示例#3
0
    def like(self) -> None:
        WebElement.find(
            self._browser).by_class("profile-action--color-yes").click()

        try:
            WebElement.find(self._browser).by_class(
                "js-chrome-pushes-deny").wait_for_visibility(2).click()
            WebElement.find(
                self._browser).by_class("ovl__content").wait_for_disappear(5)
        except TimeoutException:
            pass

        if self._is_out_of_votes():
            raise BadooError("Sorry! You've hit the vote limit!")
示例#4
0
 def is_login_failed(self) -> bool:
     try:
         return (WebElement.find(
             self._browser).by_class("new-form__error").is_displayed())
     except NoSuchElementException:
         return False
示例#5
0
 def login(self, username: str, password: str) -> None:
     WebElement.find(
         self._browser).by_class("js-signin-login").set(username)
     WebElement.find(
         self._browser).by_class("js-signin-password").set(password)
     WebElement.find(self._browser).by_css("button[type='submit']").click()
示例#6
0
 def _is_out_of_votes(self) -> bool:
     try:
         return (WebElement.find(self._browser).by_class(
             "ovl__hint").wait_for_visibility(1).is_displayed())
     except TimeoutException:
         return False
示例#7
0
 def _match(self) -> Element:
     return WebElement.find(self._browser).by_class("ovl-match")
示例#8
0
 def _is_blocker_visible(self) -> bool:
     try:
         return (WebElement.find(self._browser).by_class(
             "ovl").wait_for_visibility(1).is_displayed())
     except TimeoutException:
         return False