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


Python BuiltIn.mouse_over方法代码示例

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


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

示例1: _BrowserManagementKeywords

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import mouse_over [as 别名]

#.........这里部分代码省略.........
            username, access_key = USERNAME_ACCESS_KEY.findall(os.environ["PYROBOT_REMOTE_URL"])[0][1:]
            suite_name = BuiltIn().get_variable_value("${SUITE_NAME}")
            suite_status = BuiltIn().get_variable_value("${SUITE STATUS}")
            tags = BuiltIn().get_variable_value("${TEST_TAGS}")
            
            print "name: %s status: %s tags: %s" % (suite_name, suite_status, tags)
            
            token = (':'.join([username, access_key])).encode('base64').strip()
            payload = { 'name': suite_name,
                        'passed': suite_status == 'PASS',
                        'tags': tags}
            headers = {'Authorization': 'Basic {0}'.format(token)}
            url = 'https://saucelabs.com/rest/v1/{0}/jobs/{1}'.format(username, self._job_id)
            response = requests.put(url, data=json.dumps(payload), headers=headers)
            assert response.status_code == 200, response.text
            # video_url = json.loads(response.text).get('video_url')
            # if video_url:
                # logger.info('<a href="{0}">video.flv</a>'.format(video_url), html=True)
            ondemand_string = "SauceOnDemandSessionID=%s job-name=%s" % (self._job_id, suite_name)
            print 'setting ONDEMAND_PYRO to : %s' % ondemand_string    
            os.environ['ONDEMAND_PYRO'] = ondemand_string
            #wrapper = Wrapper(self._seleniumlib, username, access_key, sys.argv[2])
            #wrapper.update_sauce_rest(BuiltIn().get_variable_value("${SUITE STATUS}"), BuiltIn().get_variable_value("${TEST_TAGS}"))
        
        self._seleniumlib.close_browser
        self._seleniumlib.close_all_browsers
        print 'CLOSE BROWSER TIME!!'

    def selenium_drag_and_drop(self, locator_type, ele_source, ele_dest):
        self._seleniumlib.drag_and_drop('%s=%s' % (locator_type,ele_source), '%s=%s' % (locator_type,ele_dest))

    def selenium_drag_and_drop_actions(self, locator_type, ele_source, ele_dest):
        self._seleniumlib.mouse_down('%s=%s' % (locator_type,ele_source))
        self._seleniumlib.mouse_over('%s=%s' % (locator_type,ele_dest))
        self._seleniumlib.mouse_up('%s=%s' % (locator_type,ele_dest))

    def selenium_check(self, locator_type, element_locator):
        self._seleniumlib.select_checkbox('%s=%s' % (locator_type,element_locator))
  
    def selenium_uncheck(self, locator_type, element_locator):
        self._seleniumlib.unselect_checkbox('%s=%s' % (locator_type,element_locator))
    
    def selenium_wait_until_element_is_visible(self, locator_type, element_locator, _timeout=5):
        self._seleniumlib.wait_until_element_is_visible('%s=%s' % (locator_type,element_locator), timeout=_timeout)
    
    def selenium_wait_for_element_present(self, locator_type, element_locator):
        self._seleniumlib.wait_until_page_contains_element('%s=%s' % (locator_type,element_locator))
    
    def selenium_verify_text_from_element(self, locator_type, element_locator, text):
        self._seleniumlib.element_text_should_be('%s=%s' % (locator_type,element_locator), text)
    
    def selenium_reload(self, suspend_after_element_found='createUser_wiz'):
        """Refreshes the browser, which is effectively like the user pressed F5.
        Optional, supply the suspend_after_element_found with an element to find after reloading and apply the following javascript:
           window.ADTRAN.store.RefreshBaseStore.suspendAll();
           window.ADTRAN.util.SysPollTask.suspend();
        Note: Setting this to equal None will disable the javascript and wait for element functionality entirely
        """        
        print '(selenium_reload) suspend = %s' % suspend_after_element_found
        self._seleniumlib.reload_page()
        if type(suspend_after_element_found) == type(''):
            print '(selenium_reload) javascript suspendAll issued! (suspend_after_element_found == %s' % suspend_after_element_found
            self._seleniumlib.wait_until_element_is_visible(suspend_after_element_found, error='(selenium_reload) failed because the element was not found after reload')
            self._seleniumlib.execute_javascript('window.ADTRAN.store.RefreshBaseStore.suspendAll();')
            self._seleniumlib.execute_javascript('window.ADTRAN.util.SysPollTask.suspend();')
            
开发者ID:Tallisado,项目名称:pyrolibrary,代码行数:69,代码来源:_browsermanagement.py

示例2: Common

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import mouse_over [as 别名]
class Common(object):

    def __init__(self):
        # self._seleniumLib = BuiltIn().get_library_instance("lib.ExtendedSelenium2Library")
        self._selenium2Library = BuiltIn().get_library_instance("selenium2Library")

        # _title = self._seleniumLib.get_title()
        # logger.info("Working on page: %s" % (_title))
        self.elements = {
                 'btnLogout' : "yucs-signout",
                 'lblProfile' : "xpath=//a[@aria-label='Profile']",
                 'treeNavigation' : 'storm-listnav',
                 'btnSignIn' : 'login-signin',
                 'formLogin' : 'mbr-login-form',
                 'btnEmptyTrash' : 'btn-emptytrash',
                'btnEmptySpam' : 'btn-emptyspam',
                'btnConfirmOK': 'okayModalOverlay',
                'btnConfirmCancel': 'cancelModalOverlay',
                 'txtTemp' : ''
        }

    '''
    Usage: Log out
    '''
    def logout(self):
        self._selenium2Library.javascript_click(self.elements['lblProfile'], 'click')
        self._selenium2Library.wait_until_element_is_visible(self.elements['btnLogout'], 20)
        self._selenium2Library.click_element(self.elements['btnLogout'])
        #self._selenium2Library.click_element(self.elements['btnLogout'])
        self._selenium2Library.wait_until_page_load(self._selenium2Library.timeout)

    '''
    Usage: Select a node on the Navigation tree
    '''
    def select_navigation_node(self, node_name):
        # locator = 'xpath=//a[contains(@title,"' + node_name + '")]'
        # ul#storm-listnav a[title^='Sent']
        locator = "css=ul#storm-listnav a[title^='" + node_name + "']"
        locator = "xpath=//*[@id='storm-listnav']//*[starts-with(.,'"+ node_name + "')]"
        self._selenium2Library.click_element(locator)
        self._selenium2Library.wait_until_page_load(self._selenium2Library.timeout)

    '''
    Usage: Select a menu item on the master menu (most top horizontal navigation)
    '''
    def select_master_menu_item(self, menu_item):
        locator = 'xpath=//a[contains(text(),"' + menu_item + '")]'
        # The following css locators don't work. Don't know why :(
        # masterNav [id$=news]
        # locator = "css=#masterNav [id~=" + menu_item.lower() + "]"
        # locator = "css=#yucs-top-" + menu_item.lower()
        self._selenium2Library.click_link(locator)
        self._selenium2Library.wait_until_page_load(self._selenium2Library.timeout)

    '''
    Usage: Click button on the Yahoo Mail toolbar button.
    '''
    def click_toolbar_item(self, item_name):
        # Example: li[title=Mail]
        locator = 'css=li[title='+item_name+']'
        self._selenium2Library.click_element(locator)
        self._selenium2Library.wait_until_page_load(self._selenium2Library.timeout)

    '''
    Usage: Empty the Trash folder
    '''
    def empty_trash(self, confirm = True):
        locator = "css=ul#storm-listnav a[title^='Trash']"
        self._selenium2Library.mouse_over(locator)
        self._selenium2Library.wait_until_element_is_visible(self.elements['btnEmptyTrash'], 10)
        self._selenium2Library.click_element(self.elements['btnEmptyTrash'])
        if bool(confirm):
            self._selenium2Library.click_element(self.elements['btnConfirmOK'])
        else:
            self._selenium2Library.click_element(self.elements['btnConfirmCancel'])

    '''
    Usage: Empty the Spam folder
    '''
    def empty_spam(self, confirm=True):
        locator = "css=ul#storm-listnav a[title^='Spam']"
        self._selenium2Library.mouse_over(locator)
        self._selenium2Library.wait_until_element_is_visible(self.elements['btnEmptySpam'], 10)
        self._selenium2Library.click_element(self.elements['btnEmptySpam'])
        logger.info(confirm)
        if bool(confirm):
            self._selenium2Library.click_element(self.elements['btnConfirmOK'])
        else:
            self._selenium2Library.click_element(self.elements['btnConfirmCancel'])
开发者ID:vumvo,项目名称:MyFirstGitHub,代码行数:91,代码来源:Common.py

示例3: mouse_move

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import mouse_over [as 别名]
 def mouse_move(self, locator):
     """Moves the Mouse to the 'locator'"""
     selenium = BuiltIn().get_library_instance('Selenium2Library')
     selenium.mouse_over(locator)
开发者ID:Tenxlabsmm,项目名称:Demo,代码行数:6,代码来源:CommonLibrary.py


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