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


Python BuiltIn.wait_until_page_contains_element方法代码示例

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


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

示例1: wait_for_element_visible

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import wait_until_page_contains_element [as 别名]
 def wait_for_element_visible(self,locator,timeout=None,messgae=''):
         
           if(timeout == None):
               timeout = "30s"
           selenium = BuiltIn().get_library_instance('Selenium2Library')
           for iCounter in range(1,3):
                   selenium.wait_until_page_contains_element(locator,timeout)
                   selenium.wait_until_element_is_visible(locator,timeout)
           return true
开发者ID:Tungalasriharibabu,项目名称:MM1,代码行数:11,代码来源:TableData.py

示例2: _BrowserManagementKeywords

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

#.........这里部分代码省略.........
                        '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();')
            
    def selenium_type(self, locator_type, element_locator, text):
        self._seleniumlib.input_text('%s=%s' % (locator_type,element_locator), text)
    
    def selenium_clear(self, locator_type, element_locator):
        self._seleniumlib.input_text('%s=%s' % (locator_type,element_locator), '')
        
    def selenium_verify_attribute_from_element(self, locator_type, element_locator, element_class_locator, text):
        attr_value = self._seleniumlib.get_element_attribute('%s=%[email protected]%s' % (locator_type, element_locator, element_class_locator))
        BuiltIn().should_contain(text, attr_value)
    
    def selenium_click(self, locator_type, element_locator, wait_before_click=5):
        BuiltIn().sleep(wait_before_click)
        self._seleniumlib.click_element('%s=%s' % (locator_type,element_locator))

    def selenium_click_text_from_combobox(self, locator_type, element_locator, text):
        self.selenium_wait_for_element_present(locator_type, element_locator)
        self._seleniumlib.click_element('%s=%s' % (locator_type,element_locator))
        self.selenium_wait_for_element_present('xpath', "//div[contains(@class, 'x-boundlist') and not(contains(@style, 'display: none;'))]/div")
        self.selenium_click('xpath', "//div[contains(@class, 'x-boundlist') and not(contains(@style, 'display: none;'))]/div/ul/li[contains(text(), '%s')]" % text) 

    def selenium_click_text_from_combobox_search(self, locator_type, element_locator, text):
        self.selenium_wait_for_element_present(locator_type, element_locator)        
        self.selenium_type(locator_type, element_locator, text)        
        self.selenium_wait_for_element_present('xpath', "//div[contains(@class, 'x-boundlist') and not(contains(@style, 'display: none;'))]/div")
        self.selenium_click('xpath', "//div[contains(@class, 'x-boundlist') and not(contains(@style, 'display: none;'))]/div/ul/li[contains(text(), '%s')]" % text)
        
    def selenium_populate_combo_and_click_text(self, locator_type, element_locator, text, wait_before_click=5):
        self.selenium_wait_for_element_present(locator_type, element_locator)
        self.selenium_click(locator_type, element_locator)
        #self.selenium_click('xpath', "//div[contains(concat(' ', @class, ' '), 'x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-form-trigger-first')]")
        self.selenium_click('xpath', "//input[@%s='%s']/../../td[2]/div" % (locator_type,element_locator))
        BuiltIn().sleep(wait_before_click)
        #self.selenium_click('xpath', "//li[contains(text(), '%s')]" % text)
        self.selenium_click('xpath', "//div[contains(@class, 'x-boundlist') and not(contains(@style, 'display: none;'))]/div/ul/li[contains(text(), '%s')]" % text) 

    def selenium_double_click(self, locator_type, element_locator):
        self._seleniumlib.double_click_element('%s=%s' % (locator_type, element_locator))
    
    def selenium_element_should_not_be_visible(self, locator_type, element_locator):
        self._seleniumlib.element_should_not_be_visible('%s=%s' % (locator_type, element_locator))
        
    def selenium_click_by_script(self, element_locator):
        self._seleniumlib.execute_javascript("window.document.getElementById('%s').click();" % element_locator)
开发者ID:Tallisado,项目名称:pyrolibrary,代码行数:104,代码来源:_browsermanagement.py

示例3: click_on_element

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import wait_until_page_contains_element [as 别名]
 def click_on_element(self,elementLocator,timeout="60s"):
     selenium = BuiltIn().get_library_instance('Selenium2Library')
     selenium.wait_until_page_contains_element(elementLocator,timeout)
     selenium.click_element(elementLocator)
开发者ID:Tungalasriharibabu,项目名称:MM1,代码行数:6,代码来源:TableData.py


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