本文整理汇总了Python中selenium.webdriver.support.ui.WebDriverWait.startswith方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.startswith方法的具体用法?Python WebDriverWait.startswith怎么用?Python WebDriverWait.startswith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.ui.WebDriverWait
的用法示例。
在下文中一共展示了WebDriverWait.startswith方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_statsAddLink
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import startswith [as 别名]
def test_statsAddLink(self):
driver = self.driver
time.sleep(5)
# Load a different image in a different window
imageWindow2 = Util.load_image_different_window( self, driver, "aK.fits")
# Find and click on the Statistics window
statsWindow = driver.find_element_by_xpath("//div[@id='Statistics']")
self.assertIsNotNone( statsWindow, "Could not find statistics window")
ActionChains(driver).click( statsWindow ).perform()
# In Stastics context menu, open Link Settings
ActionChains(driver).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Add a link to the new image window
imageWindow2 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='CasaImageLoader2']")))
ActionChains(driver).move_to_element( statsWindow ).click( statsWindow ).drag_and_drop( statsWindow, imageWindow2).perform()
# Exit links
ActionChains(driver).move_to_element( statsWindow ).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Move to the center of the image window so data appears in the Stats Window
ActionChains(driver).move_to_element( imageWindow2 ).perform()
# Sometimes text does not appear, therefore move mouse cursor
ActionChains(driver).move_by_offset( 100, 100 ).perform()
# Check that the Stastics window is not linked to the main image window
statsText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.boundWidgets.Label']")))
statsText = statsText.get_attribute('textContent')
# Check that the Default sky text appears in the Stats Window
statsText = statsText.startswith("Default sky")
self.assertEqual( statsText, 0, "Statistics window should not be linked to multiple windows")
示例2: test_statsChangeLinkUpdate
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import startswith [as 别名]
def test_statsChangeLinkUpdate(self):
driver = self.driver
browser = selectBrowser._getBrowser()
# Test only works on Chrome
if browser ==2:
# Load an image in a new image window
imageWindow2 = Util.load_image_different_window( self, driver, "aH.fits")
# Find and click on the Statistics window
statsWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='Statistics']")))
self.assertIsNotNone( statsWindow, "Could not find statistics window")
ActionChains(driver).click( statsWindow ).perform()
# In Stastics context menu, open Link Settings
ActionChains(driver).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Remove the link from the Statistics Window to the image window
imageWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).move_to_element( imageWindow ).context_click( imageWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Change the link to the loaded image
ActionChains(driver).move_to_element( statsWindow ).click( statsWindow ).drag_and_drop( statsWindow, imageWindow2).perform()
# Exit links
ActionChains(driver).move_to_element( statsWindow ).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Move to the center of the image window so data appears in the Stats Window
ActionChains(driver).move_to_element( imageWindow2 ).perform()
# Sometimes text does not appear, therefore move mouse cursor
ActionChains(driver).move_by_offset( 100, 100 ).perform()
# First check that there is text in the Stats Window
statsText = len(driver.find_elements_by_xpath("//div[@qxclass='skel.boundWidgets.Label']"))
self.assertEqual( int(statsText), 1, "Should be able to find text in Stats Window")
# Check that the Stastics window is linked to the image window
statsText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.boundWidgets.Label']")))
statsText = statsText.get_attribute('textContent')
# Check that the Default sky text appears in the Stats Window
statsText = statsText.startswith("Default sky")
self.assertEqual( statsText, 1, "Stats window did not link to image after previous link was removed and new link was created to different window")
示例3: test_statsDefaultLinking
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import startswith [as 别名]
def test_statsDefaultLinking(self):
driver = self.driver
# Load a large test image.
Util.load_image( self, driver, "aH.fits")
# Move to the center of the image window so data appears in the Stats Window
imageWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).move_to_element( imageWindow ).perform()
# Sometimes text does not appear, therefore move mouse cursor
ActionChains(driver).move_by_offset( 100, 100 ).perform()
# Check that the Stastics window is linked to the image window
statsText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.boundWidgets.Label']")))
statsText = statsText.get_attribute('textContent')
# Check that the Default sky text appears in the Stats Window
statsText = statsText.startswith("Default sky")
self.assertEqual( statsText, 1, "Stats window is not linked to image window by default")
示例4: test_statsRemoveLink
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import startswith [as 别名]
def test_statsRemoveLink(self):
driver = self.driver
browser = selectBrowser._getBrowser()
# This test only works on Chrome
if browser == 2:
# Find and click on the Statistics window
statsWindow = driver.find_element_by_xpath("//div[@id='Statistics']")
self.assertIsNotNone( statsWindow, "Could not find statistics window")
ActionChains(driver).click( statsWindow ).perform()
# In Stastics context menu, open Link Settings
ActionChains(driver).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Remove the link from the Statistics Window to the image window
imageWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).move_to_element( imageWindow ).context_click( imageWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Exit links
ActionChains(driver).move_to_element( imageWindow ).context_click( imageWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Load a large test image.
Util.load_image( self, driver, "aH.fits")
# Move to the center of the image window so data appears in the Stats Window
imageWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).move_to_element( imageWindow ).perform()
# Sometimes text does not appear, therefore move mouse cursor
ActionChains(driver).move_by_offset( 100, 100 ).perform()
# Check that the Stastics Window is not linked to the image window
statsText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.boundWidgets.Label']")))
statsText = statsText.get_attribute('textContent')
# Check that the Default sky text appears in the Stats Window
statsText = statsText.startswith("Default sky")
self.assertEqual( statsText, 0, "Stats window is still linked to the main image window after the link was removed")
示例5: test_statsChangeLink
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import startswith [as 别名]
def test_statsChangeLink(self):
driver = self.driver
browser = selectBrowser._getBrowser()
# This test does not work on Firefox, only Chrome
if browser == 2:
# Find and click on the image window
imageWindow = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
self.assertIsNotNone( imageWindow, "Could not find image display window")
ActionChains(driver).click( imageWindow ).perform()
# Click the Window button
windowButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.toolbar.MenuButton']/div[text()='Window']/..")))
self.assertIsNotNone( windowButton, "Could not find window button in the context menu")
ActionChains(driver).click(windowButton).perform()
# Look for the add button in the submenu.
addButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div/div[text()='Add']/..")))
self.assertIsNotNone( addButton, "Could not click minimize button on window subcontext menu.")
ActionChains(driver).click( addButton ).send_keys(Keys.ARROW_RIGHT).send_keys(Keys.ENTER).perform()
# Check that we now have a generic empty window in the display and that the window count has gone up by one.
emptyWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowGenericPlugin']")))
self.assertIsNotNone( emptyWindow, "Could not find empty display window")
# Select the empty window
ActionChains(driver).click( emptyWindow ).perform()
# Change the plugin of the empty window to an image loader
ActionChains(driver).context_click( emptyWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_RIGHT).send_keys(Keys.ENTER).perform()
# Find and click on the Statistics window
statsWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='Statistics']")))
self.assertIsNotNone( statsWindow, "Could not find statistics window")
ActionChains(driver).click( statsWindow ).perform()
# In Stastics context menu, open Link Settings
ActionChains(driver).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Remove the link from the Statistics Window to the main image window
imageWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).move_to_element( imageWindow ).context_click( imageWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Change the link to the new image window
imageWindow2 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='CasaImageLoader2']")))
ActionChains(driver).move_to_element( statsWindow ).click( statsWindow ).drag_and_drop( statsWindow, imageWindow2).perform()
# Exit links
ActionChains(driver).move_to_element( statsWindow ).context_click( statsWindow ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
# Load an image in the main image window
Util.load_image( self, driver, "aH.fits")
# Move to the center of the image window so data appears in the Stats Window
ActionChains(driver).move_to_element( imageWindow ).perform()
# Sometimes text does not appear, therefore move mouse cursor
ActionChains(driver).move_by_offset( 100, 100 ).perform()
# Check that the Stastics Window is not linked to the image window
statsText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.boundWidgets.Label']")))
statsText = statsText.get_attribute('textContent')
# Check that the Default sky text appears in the Stats Window
statsText = statsText.startswith("Default sky")
self.assertEqual( statsText, 0, "Stats window is still linked to the main image window after the link was removed")