【发布时间】:2018-03-05 13:21:15
【问题描述】:
如何在我的程序中访问执行上下文以捕获屏幕截图? 以下程序将失败,因为包含文本不存在。
from ExtendedSelenium2Library import ExtendedSelenium2Library
import logging
class firsttest():
def googleit(self):
self.use_url = 'https://google.ca'
self.use_browser = 'chrome'
s2l = ExtendedSelenium2Library()
s2l.open_browser(self.use_url, self.use_browser)
s2l.maximize_browser_window()
try:
# Should fail
s2l.page_should_contain('this text does not exist on page')
except:
logger.debug('failed')
runit = firsttest()
runit.googleit()
当我运行这个程序时得到警告
WARNING - Keyword 'Capture Page Screenshot' could not be run on failure: Cannot access execution context
【问题讨论】:
标签: python selenium selenium-webdriver robotframework selenium2library