本文整理汇总了Python中selectBrowser._getSleep函数的典型用法代码示例。如果您正苦于以下问题:Python _getSleep函数的具体用法?Python _getSleep怎么用?Python _getSleep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_getSleep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getLastValue
def _getLastValue(self, driver):
timeout = selectBrowser._getSleep()
lastValueButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@class='qx-toolbar']/div[@qxclass='qx.ui.toolbar.Button'][5]")))
self.assertIsNotNone( lastValueButton, "Could not find button to go to the last valid value")
driver.execute_script( "arguments[0].scrollIntoView(true);", lastValueButton)
ActionChains(driver).click( lastValueButton ).perform()
time.sleep( timeout )
示例2: test_groupRename
def test_groupRename(self):
driver = self.driver
timeout = selectBrowser._getSleep()
#Load images
Util.load_image( self, driver, "Orion.methanol.cbc.contsub.image.fits")
Util.load_image( self, driver, "Orion.cont.image.fits")
Util.load_image( self, driver, "TWHydra_CO2_1line.image.fits")
time.sleep( 2 )
#Open the image settings
#Open the stack tab
Util.openSettings( self, driver, "Image", True )
Util.clickTab( driver, "Stack" )
#Turn off auto select
autoSelectCheck = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "autoSelectImages")))
ActionChains(driver).click( autoSelectCheck ).perform()
#Group the bottom two images.
secondItem = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Image.Stack.TreeItem']/div[text()='Orion.cont.image.fits']/..")))
actions = ActionChains( driver).key_down(Keys.SHIFT).click( secondItem )
actions.key_up( Keys.SHIFT ).perform()
#Click the group check box.
groupCheck = WebDriverWait( driver, 10).until( EC.presence_of_element_located((By.ID, "stackGroupImages")))
ActionChains(driver).click( groupCheck ).perform()
time.sleep(2)
#Change the name of the group to twoImageRGB & verify that there is a tree node with that name..
nameText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//input[starts-with(@id, 'stackLayerName')]")))
Util._changeElementText(self, driver, nameText, "twoImageRGB")
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[contains(text(),'twoImageRGB')]")))
示例3: test_minimize_restore
def test_minimize_restore(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Find a window capable of loading an image and select the window
imageWindow = WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).click( imageWindow ).perform()
time.sleep( timeout )
# Click the Window button
windowButton = driver.find_element_by_xpath( "//div[text()='Window']/..")
ActionChains(driver).click( windowButton ).perform()
# Look for the minimize button in the submenu.
minimizeButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div/div[text()='Minimize']/..")))
ActionChains(driver).click( minimizeButton ).perform()
# Verify that there is a Restore button on the status bar and no DisplayWindowImage.
restoreButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.toolbar.MenuButton']/div[contains(text(), 'Restore: CasaImageLoader')]/..")))
# Restore the window. Verify the restore button is gone from the status bar and there is a DisplayWindowImage
ActionChains(driver).click( restoreButton ).perform()
#Check that the clipping menu item is no longer available
try:
restoreLabel = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.toolbar.MenuButton']/div[contains(text(), 'Restore: CasaImageLoader')]")))
self.assertTrue( False, "Should not be able to locate the restore image loader button")
except Exception:
print "Test restore button was successfully removed"
imageWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
示例4: test_animator_to_casaimageloader
def test_animator_to_casaimageloader(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Wait for the image window to be present (ensures browser is fully loaded)
imageWindow = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
# Get the animation window count and make sure it is non-zero
animWindowList = driver.find_elements_by_xpath("//div[@qxclass='skel.widgets.Window.DisplayWindowAnimation']")
animWindowCount = len( animWindowList )
self.assertGreater( animWindowCount, 0, "There are not any animators")
# Get the image window count
imageWindowList = driver.find_elements_by_xpath("//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")
imageWindowCount = len( imageWindowList )
# Locate an animator window and bring up the right-context menu,
# changing to a CasaImageLoader.
Util.animation_to_image_window( self, driver )
time.sleep( timeout )
# Verify that the animation count has gone down by one and the image count
# has increased by one.
animWindowList = driver.find_elements_by_xpath("//div[@qxclass='skel.widgets.Window.DisplayWindowAnimation']")
newAnimWindowCount = len( animWindowList )
self.assertEqual( animWindowCount - 1, newAnimWindowCount, "Animation count did not decrease")
imageWindowList = driver.find_elements_by_xpath("//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")
newImageWindowCount = len( imageWindowList )
self.assertEqual( newImageWindowCount - 1, imageWindowCount, "Image window count did not increase")
示例5: test_animatorIncreaseFrame
def test_animatorIncreaseFrame(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Open a test image so we have something to animate
Util.load_image(self, driver, "aH.fits")
Util.load_image(self, driver, "aJ.fits")
Util.load_image(self, driver, "Default")
# Go to the first channel value and record the frame value
self._getFirstValue(driver, "Channel")
firstChannelValue = self._getCurrentValue(driver, "Channel")
# Find the increment by one button on the Channel Animator Tape Deck and click it
self._getNextValue(driver, "Channel")
# Check that the channel text box value is now 1
currChannelValue = self._getCurrentValue(driver, "Channel")
print "Check increase frame..."
print "oldChannelValue= 0 newChannelValue=", currChannelValue
self.assertEqual(int(currChannelValue), int(firstChannelValue) + 1, "Failed to increment Channel Animator")
# Record the first image value
self._getFirstValue(driver, "Image")
firstImageValue = self._getCurrentValue(driver, "Image")
# Find the increment by one button on the Animator Tape Deck and click it
self._getNextValue(driver, "Image")
# Check that the image text box value is now 1
currImageValue = self._getCurrentValue(driver, "Image")
print "Check increase image..."
print "oldImageValue=", firstImageValue, "newImageValue=", currImageValue
self.assertEqual(int(currImageValue), int(firstImageValue) + 1, "Failed to increment the Image Animator")
示例6: test_load_images
def test_load_images(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Load a specific image.
imageWindow = Util.load_image(self, driver, "aH.fits")
time.sleep( timeout )
Util.load_image( self, driver, "aJ.fits")
time.sleep( timeout )
Util.load_image( self, driver, "N15693D.fits")
time.sleep( timeout )
Util.load_image( self, driver, "Orion.cont.image.fits")
time.sleep( timeout )
Util.load_image( self, driver, "Orion.methanol.cbc.contsub.image.fits")
time.sleep( timeout )
Util.load_image( self, driver, "TWHydra_CO2_1line.image.fits")
time.sleep( timeout )
Util.load_image( self, driver, "br1202_wide.image")
time.sleep( timeout )
Util.load_image( self, driver, "TWHydra_CO3_2line.image")
time.sleep( timeout )
Util.load_image( self, driver, "TWHydra_cont1.3mm.image")
time.sleep( timeout )
Util.load_image( self, driver, "v2.0_ds2_l000_13pca_map20.fits")
time.sleep( timeout )
#Find the image animator and verify that there are 9 images loaded
upperBoundText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='ImageUpperBoundSpin']/input")))
driver.execute_script( "arguments[0].scrollIntoView(true);", upperBoundText)
imageCount = upperBoundText.get_attribute("value")
print "Image Count: ", imageCount
self.assertEqual( imageCount, str(9), "Wrong number of images were loaded")
示例7: test_negativeRegionWidth
def test_negativeRegionWidth(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Load a specific image.
imageWindow = Util.load_image(self, driver, "Default")
time.sleep( timeout )
# Load a specific region in the image.
Util.load_image( self, driver, "OrionMethanolRegion.crtf")
time.sleep( 4 )
#Open the image settings
#Open the stack tab
Util.openSettings( self, driver, "Image", True )
time.sleep(4)
Util.clickTab( driver, "Regions" )
#Change the width to -40 and check for an error.
widthText = driver.find_element_by_xpath("//div[@id='RectangleRegionWidth']/input")
driver.execute_script( "arguments[0].scrollIntoView(true);", widthText )
Util._changeElementText(self, driver, widthText, -10)
widthError = driver.find_element_by_xpath("//div[@id='RectangleRegionWidth']/div[contains(text(),'Range error:')]")
self.assertIsNotNone( widthError, "No error was posted")
time.sleep( timeout )
#Change the width to 40 and check that the error is not there
Util._changeElementText(self, driver, widthText, 40 );
try:
widthError = driver.find_element_by_xpath("//div[@id='RectangleRegionWidth']/div[contains(text(),'Range error:')]")
self.assertTrue( False, "Should not be able to find a range error.")
except Exception:
print "Good, the error disappeared!"
示例8: test_globalIsGlobal
def test_globalIsGlobal(self):
driver = self.driver
timeout = selectBrowser._getSleep()
#Load a default image
Util.load_image( self, driver, "Default")
Util.load_image( self, driver, "aJ.fits")
Util.load_image( self, driver, "aH.fits")
#Store the old colormap
oldMapName = self._getColorMapName( driver )
print "Old map name=",oldMapName
#Choose a new color map
self._chooseNewColorMap( driver )
newMapName = self._getColorMapName( driver )
print "New map name=", newMapName
self.assertTrue( oldMapName != newMapName, "Color map name did not change")
#Animate through the images and make sure they are all using the
#new color map.
for i in range(0,2):
self._nextImage( driver )
imageMapName = self._getColorMapName( driver )
print "Image name=",imageMapName
self.assertTrue( imageMapName == newMapName, "Image name was not changed")
示例9: test_newProfileExisting
def test_newProfileExisting(self):
driver = self.driver
timeout = selectBrowser._getSleep()
print "Timeout=",timeout
#Load two images
Util.load_image(self, driver, "Orion.methanol.cbc.contsub.image.fits" )
time.sleep(1)
Util.load_image(self, driver, "TWHydra_CO2_1line.image.fits" )
time.sleep( 1)
# Show the profile view
self._showProfile( driver )
time.sleep(2)
#Open the profile settings to the Profiles tab.
profileWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowProfile']")))
ActionChains(driver).click( profileWindow ).perform()
time.sleep(2)
Util.openSettings( self, driver, "Profile", True )
time.sleep(2)
Util.clickTab( driver, "Profiles" )
#Get the profiles combo and count how many are listed. Since
#the mode is auto generate and current there should be just one.
self._checkProfileCount( driver, 1)
#Turn off auto generate.
Util.clickTab( driver, "Profiles" )
self._setAutoGenerate( driver, False )
time.sleep( timeout )
#Store the image rest frequency.
restFrequency = self._getRestFrequency( driver )
#Select the other image and test the rest frequency changes to match
#the selected image
comboPath = "//div[starts-with(@id,'ProfileSelectedImage')]"
imageCombo = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, comboPath)))
driver.execute_script( "arguments[0].scrollIntoView(true);", imageCombo )
ActionChains(driver).click( imageCombo ).perform()
ActionChains(driver).click( imageCombo).send_keys(Keys.UP).send_keys( Keys.ENTER).perform()
time.sleep( timeout )
newRestFrequency = self._getRestFrequency( driver )
self.assertNotEqual( restFrequency, newRestFrequency, "Image rest frequency did not change")
#Hit the new profile button.
self._hitNew( driver )
time.sleep( 4 )
#Verify that we now have two profiles.
self._checkProfileCount( driver, 2 )
#Turn on auto generate
Util.clickTab( driver, "Profiles" )
self._setAutoGenerate( driver, True )
time.sleep( timeout )
#Verify that we are back to one profile.
self._checkProfileCount( driver, 1 )
示例10: test_profileRegion
def test_profileRegion(self):
driver = self.driver
timeout = selectBrowser._getSleep()
#Load a default image
Util.load_image( self, driver, "Orion.methanol.cbc.contsub.image.fits")
time.sleep( timeout )
#Load a region for the image
Util.load_image( self, driver, "OrionMethanolRegion.crtf")
time.sleep( timeout )
self._showProfile( driver )
time.sleep( timeout )
#Open the profile settings to the Profiles tab.
profileWindow = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowProfile']")))
ActionChains(driver).click( profileWindow ).perform()
time.sleep( timeout )
Util.openSettings( self, driver, "Profile", True )
time.sleep( timeout )
Util.clickTab( driver, "Profiles" )
time.sleep( timeout )
#Check that there is a region we are profiling
regionCombo = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "ProfileSelectedRegion")))
driver.execute_script( "arguments[0].scrollIntoView(true);", regionCombo )
nameDiv = regionCombo.find_element_by_xpath( ".//div/div")
regionName = nameDiv.get_attribute( "innerHTML").strip()
print "Region is ",regionName
self.assertTrue( regionName != "None", "Expected a region to be profiled")
示例11: test_clip100
def test_clip100(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Load a specific image.
imageWindow = Util.load_image(self, driver, "Default")
time.sleep( timeout )
# Store the minimum clip value
minClipText = driver.find_element_by_xpath("//div[@id='clipMinIntensity']/input")
driver.execute_script( "arguments[0].scrollIntoView(true);", minClipText )
minClip = minClipText.get_attribute( "value")
print "Min intensity", minClip
# Press the 100% clip button
ActionChains(driver).double_click( imageWindow ).perform()
clippingButton = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//div[text()='Clipping']/..")))
ActionChains(driver).click( clippingButton ).send_keys(Keys.ARROW_RIGHT
).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN
).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN
).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN
).send_keys(Keys.ENTER).perform()
time.sleep( timeout )
# Make sure the minimum clip value goes down.
newMinClip = minClipText.get_attribute( "value")
print "New min intensity", newMinClip
self.assertTrue( float(newMinClip) < float(minClip), "Minimum clip value did not go down")
示例12: test_animator_jump
def test_animator_jump(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Wait for the image window to be present (ensures browser is fully loaded)
imageWindow = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
# Set the animator to jump
self._setAnimatorToJump( driver );
# Save the preferences
self._savePreferences(driver )
# Find the wrap radio button in the animator settings and click it
wrapButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.form.RadioButton']/div[text()='Wrap']/following-sibling::div")))
self.assertIsNotNone( wrapButton, "Could not find wrap button in settings")
self._setChecked( driver, wrapButton, True )
# Restore the preferences
self._restorePreferences( driver )
time.sleep( timeout )
# Verify the animator jump end behavior is checked
jumpButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.form.RadioButton']/div[text()='Jump']/following-sibling::div")))
self.assertIsNotNone( jumpButton, "Could not find jump button in settings")
self._verifyChecked( driver, jumpButton )
示例13: test_toolbar_hide
def test_toolbar_hide(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Wait for the image window to be present (ensures browser is fully loaded)
imageWindow = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
ActionChains(driver).click( imageWindow).perform()
time.sleep( timeout )
# Find the preferences button on the menu bar and click it.
menuBar = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Menu.MenuBar']")))
#self.assertIsNotNone( menuBar, "Could not find the menu bar")
preferencesButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[text()='Preferences']/..")))
#self.assertIsNotNone( preferencesButton, "Could not find div with text Preferences")
ActionChains(driver).click(preferencesButton).perform()
# Click the show button on the sub menu.
showButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div/div[text()='Show']/..")))
ActionChains(driver).click( showButton).perform()
showToolButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[text()='Show Tool Bar']/..")))
ActionChains(driver).click( showToolButton).perform()
time.sleep( timeout )
# Verify the toolbar is NOT visible
toolVisible = self._isToolbarVisible( driver )
self.assertFalse( toolVisible, "Tool bar was not hidden")
# Save the preferences
self._savePreferences( driver )
# Show the toolbar
# Find the preferences button on the menu bar and click it.
preferencesButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[text()='Preferences']/..")))
ActionChains(driver).click(preferencesButton).perform()
# Click the show tool bar button on the sub menu.
ActionChains(driver).send_keys( Keys.ARROW_DOWN ).send_keys( Keys.ARROW_RIGHT ).send_keys( Keys.ARROW_DOWN ).send_keys( Keys.ARROW_DOWN ).send_keys( Keys.ENTER ).perform()
time.sleep( timeout )
#Verify the toolbar is now visible
toolBar = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Menu.ToolBar']")))
# Click the restore sessions button
self._clickSessionButton( driver )
self._clickSessionRestoreButton( driver )
# Select tSnapshotPreferences in the restore combo box
self._selectRestoreSnapshot( driver, "tSnapshotPreferences")
# Hit the restore button
self._restoreSnapshot( driver )
# Close the restore dialog
self._closeRestore( driver )
time.sleep( timeout )
# Verify the toolbar is hidden again
toolVisible = self._isToolbarVisible( driver)
self.assertFalse( toolVisible, "Tool bar was not hidden with restore state")
示例14: test_animator_jump
def test_animator_jump(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Wait for the image window to be present (ensures browser is fully loaded)
imageWindow = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Window.DisplayWindowImage']")))
# There must be an image loaded with more than one channel to see the animator.
Util.load_image(self,driver, "TWHydra_CO2_1line.image.fits" )
# Set the animator to jump
self._setAnimatorToJump( driver );
# Save the preferences
self._savePreferences(driver )
# Find the wrap radio button in the animator settings and click it
wrapButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "ChannelWrapRadioButton")))
self._setChecked( driver, wrapButton, True )
# Restore the preferences
self._restorePreferences( driver )
time.sleep( timeout )
# Verify the animator jump end behavior is checked
jumpButton = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='qx.ui.form.RadioButton']/div[text()='Jump']/following-sibling::div")))
self._verifyChecked( driver, jumpButton )
示例15: test_deleteImageFromRegion
def test_deleteImageFromRegion(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Load a specific image.
imageWindow = Util.load_image(self, driver, "Default")
time.sleep( timeout )
# Load a specific region in the image.
Util.load_image( self, driver, "OrionMethanolRegion.crtf")
time.sleep( 4 )
#Open the image settings
#Open the regions tab
Util.openSettings( self, driver, "Image", True )
time.sleep(4)
Util.clickTab( driver, "Regions" )
#Verify that there is one region in the region list.
self._checkRegionCount( driver, 1 );
# Click on the Data->Close->Image button to close the image.
ActionChains(driver).double_click( imageWindow ).perform()
dataButton = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, "//div[text()='Data']/..")))
ActionChains(driver).click( dataButton ).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(
Keys.ARROW_RIGHT).send_keys(Keys.ENTER).perform()
time.sleep( timeout )