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


Python WebDriverWait.is_displayed方法代码示例

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


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

示例1: test_logout_link_visible

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def test_logout_link_visible(self):
     nav_logout = WebDriverWait(self.browser, 10).until(
         expected_conditions.presence_of_element_located((By.ID, "nav_logout"))
     )
     self.assertFalse(nav_logout.is_displayed(), "The dropdown menu logout item must not be displayed yet!")
     # Activate the dropdown menu and see if the logout link is visible.
     dropdown_menu = self.browser.find_element_by_xpath("//*[@id=\"wrapper\"]/div[1]/div/div/div[2]/ul/li[7]/a")
     WebDriverWait(self.browser, 3).until(
         expected_conditions.visibility_of(dropdown_menu)
     )
     self.browser_activate_element(elem=dropdown_menu)
     self.assertTrue(nav_logout.is_displayed(), "The dropdown menu logout item is not displayed!")
开发者ID:JGOODYEARUCSD,项目名称:ka-lite,代码行数:14,代码来源:distributed.py

示例2: testExpectedConditionVisibilityOfElementLocated

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def testExpectedConditionVisibilityOfElementLocated(self, driver, pages):
     pages.load("javascriptPage.html")
     with pytest.raises(TimeoutException):
         WebDriverWait(driver, 0.7).until(EC.visibility_of_element_located((By.ID, 'clickToHide')))
     driver.find_element_by_id('clickToShow').click()
     element = WebDriverWait(driver, 5).until(EC.visibility_of_element_located((By.ID, 'clickToHide')))
     assert element.is_displayed() is True
开发者ID:zhjwpku,项目名称:selenium,代码行数:9,代码来源:webdriverwait_tests.py

示例3: testExpectedConditionInvisiblityOfElementLocated

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def testExpectedConditionInvisiblityOfElementLocated(self, driver, pages):
     pages.load("javascriptPage.html")
     driver.execute_script("delayedShowHide(0, true)")
     with pytest.raises(TimeoutException):
         WebDriverWait(driver, 0.7).until(EC.invisibility_of_element_located((By.ID, 'clickToHide')))
     driver.execute_script("delayedShowHide(200, false)")
     element = WebDriverWait(driver, 0.7).until(EC.invisibility_of_element_located((By.ID, 'clickToHide')))
     assert element.is_displayed() is False
开发者ID:zhjwpku,项目名称:selenium,代码行数:10,代码来源:webdriverwait_tests.py

示例4: get_library_item

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def get_library_item(self, item_name):
     """ Return element for library item `item_name`. """
     xpath = "//table[(@id='objtypetable')]//td[(@modpath='%s')]" % item_name
     library_item = WebDriverWait(self.browser, TMO).until(
         lambda browser: browser.find_element_by_xpath(xpath))
     WebDriverWait(self.browser, TMO).until(
         lambda browser: library_item.is_displayed())
     return library_item
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:workspace.py

示例5: get_waited_invisible_element

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def get_waited_invisible_element(self, css_selector):
     element = WebDriverWait(self.browser, 10).until(
                 EC.invisibility_of_element_located((
                     By.CSS_SELECTOR, css_selector))
     )
     self.assertIsNotNone(element)
     self.assertFalse(element.is_displayed())
     return element
开发者ID:wanrumwie,项目名称:koopsite,代码行数:10,代码来源:ft_base.py

示例6: is_element_present

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
    def is_element_present(self, path):
        element = WebDriverWait(self.driver, 10).until(
            lambda driver: driver.find_element_by_xpath(path)
        )

        if element.is_displayed():
            return True
        else:
            return False
开发者ID:Zeliboba5,项目名称:home-assignment-4,代码行数:11,代码来源:page_object.py

示例7: is_news_description_visible

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
    def is_news_description_visible(self):
        element = WebDriverWait(self.driver, 10).until(
            lambda driver: driver.find_element_by_xpath(self.news_description)
        )

        if element.is_displayed():
            return True
        else:
            return False
开发者ID:Zeliboba5,项目名称:home-assignment-4,代码行数:11,代码来源:page_object.py

示例8: testExpectedConditionInvisiblityOfElement

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
def testExpectedConditionInvisiblityOfElement(driver, pages):
    pages.load("javascriptPage.html")
    target = driver.find_element_by_id('clickToHide')
    driver.execute_script("delayedShowHide(0, true)")
    with pytest.raises(TimeoutException):
        WebDriverWait(driver, 0.7).until(EC.invisibility_of_element(target))
    driver.execute_script("delayedShowHide(200, false)")
    element = WebDriverWait(driver, 0.7).until(EC.invisibility_of_element(target))
    assert element.is_displayed() is False
    assert target == element
开发者ID:SeleniumHQ,项目名称:selenium,代码行数:12,代码来源:webdriverwait_tests.py

示例9: testExpectedConditionVisibilityOfElementLocated

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def testExpectedConditionVisibilityOfElementLocated(self):
     self._loadPage("javascriptPage")
     try:
         WebDriverWait(self.driver, 0.7).until(EC.visibility_of_element_located((By.ID, 'clickToHide')))
         self.fail("Expected TimeoutException to have been thrown")
     except TimeoutException as e:
         pass
     self.driver.find_element_by_id('clickToShow').click()
     element = WebDriverWait(self.driver, 5).until(EC.visibility_of_element_located((By.ID, 'clickToHide')))
     self.assertTrue(element.is_displayed())
开发者ID:NextGenIntelligence,项目名称:selenium,代码行数:12,代码来源:webdriverwait_tests.py

示例10: testExpectedConditionInvisiblityOfElementLocated

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def testExpectedConditionInvisiblityOfElementLocated(self, driver, pages):
     if driver.capabilities['browserName'] == 'firefox' and driver.w3c:
         pytest.xfail("Marionette issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1297551")
     pages.load("javascriptPage.html")
     driver.execute_script("delayedShowHide(0, true)")
     with pytest.raises(TimeoutException):
         WebDriverWait(driver, 0.7).until(EC.invisibility_of_element_located((By.ID, 'clickToHide')))
     driver.execute_script("delayedShowHide(200, false)")
     element = WebDriverWait(driver, 0.7).until(EC.invisibility_of_element_located((By.ID, 'clickToHide')))
     assert element.is_displayed() is False
开发者ID:glib-briia,项目名称:selenium,代码行数:12,代码来源:webdriverwait_tests.py

示例11: testExpectedConditionInvisiblityOfElementLocated

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def testExpectedConditionInvisiblityOfElementLocated(self):
     self._loadPage("javascriptPage")
     self.driver.execute_script("delayedShowHide(0, true)")
     try:
         WebDriverWait(self.driver, 0.7).until(EC.invisibility_of_element_located((By.ID, 'clickToHide')))
         self.fail("Expected TimeoutException to have been thrown")
     except TimeoutException as e:
         pass
     self.driver.execute_script("delayedShowHide(200, false)")
     element = WebDriverWait(self.driver, 0.7).until(EC.invisibility_of_element_located((By.ID, 'clickToHide')))
     self.assertFalse(element.is_displayed())
开发者ID:NextGenIntelligence,项目名称:selenium,代码行数:13,代码来源:webdriverwait_tests.py

示例12: then_i_should_see_landing_page

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
def then_i_should_see_landing_page(step, landing_page):

    if landing_page == "Dashboard":
       dashboard = world.driver.find_element_by_css_selector(".dashboard-home")
       if not dashboard.is_displayed():
           world.log.info("No dashboard is presented.")
           raise AssertionError
    elif landing_page == "Internal Contact Entities":
        dashboard = WebDriverWait(world.driver, 60).until(EC.presence_of_element_located((By.CSS_SELECTOR,
                                                                                         ".entities-list")))

        #dashboard = world.driver.find_element_by_css_selector(".entities-list")
        if not dashboard.is_displayed():
            world.log.info("No internal contact entities page is presented.")
            raise AssertionError
开发者ID:arkridge,项目名称:strevus_ui_tools,代码行数:17,代码来源:steps.py

示例13: check_for_connection

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def check_for_connection(self):
     
     while 1:
         element = WebDriverWait(self.browser, 10).until(
         EC.presence_of_element_located((By.ID, "accept_new_partner"))
         )
         chat_input_element = self.browser.find_element_by_id("chat_input")
         check_this = chat_input_element.is_displayed() 
         condition = element.is_displayed()
         if condition or check_this :
             if condition: 
                 element.click()
                 accepted_rec = Testing.get_date_time()
                 Testing.open_log_file(accepted_rec, 'accepted_connection', self.username)
                 Testing.checking_for_msg()
                 return True
开发者ID:revanthpobala,项目名称:lilac-testing_v2.0,代码行数:18,代码来源:listener.py

示例14: test_has_date_and_time_picker_widget

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
    def test_has_date_and_time_picker_widget(self):
        datetime_picker_icon = self.selenium.find_element_by_class_name('glyphicon-calendar')

        ActionChains(self.selenium).click(datetime_picker_icon).perform()

        try:
            datetime_picker_widget = WebDriverWait(self.selenium, 10).until(
                EC.presence_of_element_located((By.CLASS_NAME, 'bootstrap-datetimepicker-widget'))
            )
            active_day = datetime_picker_widget.find_element_by_class_name('active')

            ActionChains(self.selenium).click(active_day).perform()

            selected_datetime = self.selenium.find_element_by_id('id_visit_schedule').get_attribute('value')
            self.assertTrue(datetime_picker_widget.is_displayed())
            self.assertEqual(time.strftime('%m/%d/%Y %I: %p'),
                             time.strftime('%m/%d/%Y %I: %p', time.strptime(selected_datetime, '%m/%d/%Y %I:%M %p')))
        except TimeoutException as e:
            self.fail('Unable to Execute Test Properly')
开发者ID:asabalon,项目名称:cs260,代码行数:21,代码来源:tests_add_appointment.py

示例15: get_library_item

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import is_displayed [as 别名]
 def get_library_item(self, item_name):
     """ Return element for library item `item_name`. """
     xpath = "//table[(@id='objtypetable')]//td[(@modpath='%s')]" % item_name
     library_item = WebDriverWait(self.browser, TMO).until(
         lambda browser: browser.find_element_by_xpath(xpath))
     for retry in range(3):
         try:
             WebDriverWait(self.browser, TMO).until(
                 lambda browser: library_item.is_displayed())
         except StaleElementReferenceException:
             if retry < 2:
                 logging.warning('get_library_item:'
                                 ' StaleElementReferenceException')
                 library_item = WebDriverWait(self.browser, TMO).until(
                     lambda browser: browser.find_element_by_xpath(xpath))
             else:
                 raise
         else:
             break
     return library_item
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:22,代码来源:workspace.py


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