本文整理汇总了Python中Selenium2Library.locators.WindowManager._get_window_infos方法的典型用法代码示例。如果您正苦于以下问题:Python WindowManager._get_window_infos方法的具体用法?Python WindowManager._get_window_infos怎么用?Python WindowManager._get_window_infos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Selenium2Library.locators.WindowManager
的用法示例。
在下文中一共展示了WindowManager._get_window_infos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _BrowserManagementKeywords
# 需要导入模块: from Selenium2Library.locators import WindowManager [as 别名]
# 或者: from Selenium2Library.locators.WindowManager import _get_window_infos [as 别名]
#.........这里部分代码省略.........
finally:
self._window_manager.select(self._current_browser(), locator)
def wait_for_select_window(self, locator=None, max_timeout=10):
if locator is None:
self.select_window(locator)
return
locator_parts = locator.partition('=')
if len(locator_parts) < 1:
raise ValueError('syntax error: unexpected identifier')
prefix = locator_parts[0]
criteria =locator_parts[2]
index = 0
if prefix == 'title':
index = 3
elif prefix == 'name':
index = 2
elif prefix == 'url':
index = 4
else:
raise ValueError('syntax error: unexpected identifier')
timeout = robot.utils.timestr_to_secs(max_timeout)
max_time = time.time() + timeout
FIND = False
while True:
infos = self._window_manager._get_window_infos(self._current_browser())
for info in infos:
if info[index].strip().lower() == criteria.lower():
FIND = True
break
if FIND:
break
if time.time() > max_time:
raise AssertionError('Timeout error raised by text \'%s\'' % criteria)
time.sleep(0.2)
self.select_window(locator)
def list_windows(self):
"""Return all current window handles as a list"""
return self._current_browser().get_window_handles()
def unselect_frame(self):
"""Sets the top frame as the current frame."""
self._current_browser().switch_to_default_content()
# Public, browser/current page properties
def get_location(self):
"""Returns the current location."""
return self._current_browser().get_current_url()
def get_source(self):
"""Returns the entire html source of the current page or frame."""
return self._current_browser().get_page_source()