当前位置: 首页>>代码示例>>Python>>正文


Python WebDriverWait.until_not方法代码示例

本文整理汇总了Python中selenium.webdriver.support.wait.WebDriverWait.until_not方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.until_not方法的具体用法?Python WebDriverWait.until_not怎么用?Python WebDriverWait.until_not使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.support.wait.WebDriverWait的用法示例。


在下文中一共展示了WebDriverWait.until_not方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
    def get(self, url):
        super(WebDriverMixin, self).get('about:blank')
        full_url = urljoin(self._base_url, url)
        self.execute_script(
            """
            window.name = "{}" + window.name;
            window.location.replace("{}");
            """.format(DEFER_LABEL, full_url)
        )
        wait = WebDriverWait(self, 10)
        wait.until_not(self._location_equals, 'about:blank')

        if not self.ignore_synchronization:
            test_result = self._test_for_angular()
            angular_on_page = test_result[0]
            if not angular_on_page:
                message = test_result[1]
                raise AngularNotFoundException(
                    'Angular could not be found on page: {}:'
                    ' {}'.format(full_url, message)
                )
            # TODO: inject scripts here
            # return self.execute_script(
            #     'angular.resumeBootstrap(arguments[0]);'
            # )
            self.execute_script('angular.resumeBootstrap();')
开发者ID:tonysimpson,项目名称:pytractor,代码行数:28,代码来源:mixins.py

示例2: decorate

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
 def decorate(self, *args, **kwargs):
     f(self, *args, **kwargs)
     for selector in selectors:
         try:
             driver = self.test if 'test' in self.__class__.__dict__ else self.driver
             wait = WebDriverWait(driver, float(config.timeout['normal']))
             if appear:
                 wait.until(lambda dr: dr.find_element_by_css_selector(selector).is_displayed())
             else:
                 wait.until_not(lambda dr: dr.find_element_by_css_selector(selector).is_displayed())
         except ElementNotFound:
             continue
开发者ID:2gis,项目名称:mapsapi,代码行数:14,代码来源:decorators.py

示例3: deselect_all_target_region_chosen

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
    def deselect_all_target_region_chosen(self):
        css_selector = '.campaign-setting__chosen-box__item__close'
        wait = WebDriverWait(self.driver, 10)

        try:
            wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, css_selector)))
            elements = self.driver.find_elements_by_css_selector(css_selector)

            for element in elements:
                element.click()
                wait.until_not(EC.visibility_of(element))
        except Exception:
            pass
开发者ID:f1nality,项目名称:tech-testing-ha2,代码行数:15,代码来源:pages.py

示例4: _find_with_timemout_or_directly

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
 def _find_with_timemout_or_directly(self, locator, rule, timeout=-1, must_be_clickable=True):
     if timeout > 0:
         condition = EC.element_to_be_clickable
         waiter = WebDriverWait(self.driver, timeout)
         if not must_be_clickable:
             waiter.until_not(condition((locator, rule)))
             element = self.driver.find_element(locator, rule)
         else:
             element = waiter.until(condition((locator, rule)))
     else:
         element = self.driver.find_element(locator, rule)
         if must_be_clickable and not element.is_enabled():
             raise TimeoutException("Can't find clickable element")
     return element
开发者ID:dcolam,项目名称:test-automation-framework,代码行数:16,代码来源:SeleniumWrapper.py

示例5: _wait_until_displayed_or_not

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
    def _wait_until_displayed_or_not(self, displayed, wait_in_seconds=None):
        """Wait until this Element is displayed or not.

        :returns: this Element.
        """
        if wait_in_seconds is None:
            wait_in_seconds = self.web_app.default_wait

        assert wait_in_seconds > 0
        ignoring = [
            StaleElementReferenceException,
            NoSuchElementException
        ]
        wait = WebDriverWait(self.web_app.driver, wait_in_seconds, .25, ignoring)

        if displayed:
            wait.until(self._is_displayed_for_wait)
        else:
            wait.until_not(self._is_displayed_for_wait)

        return self
开发者ID:sawatzkylindsey,项目名称:korlat,代码行数:23,代码来源:element.py

示例6: __init__

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
class WaitTool:

    def __init__(self, driver):
        self.driver = driver
        self.wait = WebDriverWait(self.driver, 30)

    def wait_until_element_is_visible(self, method, *args):
        """
        This function will wait for element to be enable in UI
        NOTE : if you are using lamda so please send the method directly
        ex : element_to_wait = lamda self: self.findelement_by_xpath("//abcd")
        then use : wait_until_element_is_invisible(self.element_to_wait)
        no use like this : wait_until_element_is_invisible(self.element_to_wait())
        :param method: method without calling (object of method)
        :param args: if lamda is excepting any args then send here, if not then leave it blank
        """
        self.wait.until(EC.visibility_of(method(*args)), " elements still visible after 45 sec")

    def wait_until_element_is_invisible(self, method, *args):
        """
        This function will wait for element to be disable in UI
        NOTE : if you are using lamda so please send the method directly
        ex : element_to_wait = lamda self: self.findelement_by_xpath("//abcd")
        then use : wait_until_element_is_invisible(self.element_to_wait)
        no use like this : wait_until_element_is_invisible(self.element_to_wait())
        :param method: method without calling (object of method)
        :param args: if lamda is excepting any args then send here, if not then leave it blank
        """
        try:
            self.wait.until_not(EC.visibility_of(method(*args)), "element is still visible after 45 sec")
        except (NoSuchElementException, StaleElementReferenceException):
            # In the case of NoSuchElement, returns true because the element is
            # not present in DOM. The try block checks if the element is present
            # but is invisible.
            # In the case of StaleElementReference, returns true because stale
            # element reference implies that element is no longer visible.
            pass
开发者ID:Gaurang033,项目名称:blog,代码行数:39,代码来源:wait_tool.py

示例7: wait_until_element_is_not_present

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import until_not [as 别名]
 def wait_until_element_is_not_present(self, locator, timeout=5):
     wait = WebDriverWait(self.driver, timeout)
     try:
         wait.until_not(expected_conditions.presence_of_element_located(locator))
         return True
     except WebDriverException: return False
开发者ID:AnnaQC,项目名称:capture_tmp,代码行数:8,代码来源:base_page.py


注:本文中的selenium.webdriver.support.wait.WebDriverWait.until_not方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。