本文整理汇总了Python中emulator.Emulator.check_for_crash方法的典型用法代码示例。如果您正苦于以下问题:Python Emulator.check_for_crash方法的具体用法?Python Emulator.check_for_crash怎么用?Python Emulator.check_for_crash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emulator.Emulator
的用法示例。
在下文中一共展示了Emulator.check_for_crash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Marionette
# 需要导入模块: from emulator import Emulator [as 别名]
# 或者: from emulator.Emulator import check_for_crash [as 别名]
#.........这里部分代码省略.........
raise ElementNotVisibleException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_ELEMENT_STATE:
raise InvalidElementStateException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.UNKNOWN_ERROR:
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.ELEMENT_IS_NOT_SELECTABLE:
raise ElementNotSelectableException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.JAVASCRIPT_ERROR:
raise JavascriptException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.XPATH_LOOKUP_ERROR:
raise XPathLookupException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.TIMEOUT:
raise TimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_SUCH_WINDOW:
raise NoSuchWindowException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_COOKIE_DOMAIN:
raise InvalidCookieDomainException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.UNABLE_TO_SET_COOKIE:
raise UnableToSetCookieException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_ALERT_OPEN:
raise NoAlertPresentException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.SCRIPT_TIMEOUT:
raise ScriptTimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_SELECTOR \
or status == ErrorCodes.INVALID_XPATH_SELECTOR \
or status == ErrorCodes.INVALID_XPATH_SELECTOR_RETURN_TYPER:
raise InvalidSelectorException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.MOVE_TARGET_OUT_OF_BOUNDS:
MoveTargetOutOfBoundsException(message=message, status=status, stacktrace=stacktrace)
else:
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
raise MarionetteException(message=response, status=500)
def check_for_crash(self):
returncode = None
name = None
if self.emulator:
if self.emulator.check_for_crash():
returncode = self.emulator.proc.returncode
name = 'emulator'
elif self.instance:
# In the future, a check for crashed Firefox processes
# should be here.
pass
if returncode is not None:
print ('TEST-UNEXPECTED-FAIL - PROCESS CRASH - %s has terminated with exit code %d' %
(name, returncode))
return returncode is not None
def absolute_url(self, relative_url):
return "%s%s" % (self.baseurl, relative_url)
def status(self):
return self._send_message('getStatus', 'value')
def start_session(self, desired_capabilities=None):
# We are ignoring desired_capabilities, at least for now.
self.session = self._send_message('newSession', 'value')
self.b2g = 'b2g' in self.session
return self.session
def delete_session(self):
response = self._send_message('deleteSession', 'ok')
self.session = None
self.window = None
self.client.close()
示例2: Marionette
# 需要导入模块: from emulator import Emulator [as 别名]
# 或者: from emulator.Emulator import check_for_crash [as 别名]
#.........这里部分代码省略.........
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.ELEMENT_IS_NOT_SELECTABLE:
raise ElementNotSelectableException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.JAVASCRIPT_ERROR:
raise JavascriptException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.XPATH_LOOKUP_ERROR:
raise XPathLookupException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.TIMEOUT:
raise TimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_SUCH_WINDOW:
raise NoSuchWindowException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_COOKIE_DOMAIN:
raise InvalidCookieDomainException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.UNABLE_TO_SET_COOKIE:
raise UnableToSetCookieException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_ALERT_OPEN:
raise NoAlertPresentException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.SCRIPT_TIMEOUT:
raise ScriptTimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_SELECTOR \
or status == ErrorCodes.INVALID_XPATH_SELECTOR \
or status == ErrorCodes.INVALID_XPATH_SELECTOR_RETURN_TYPER:
raise InvalidSelectorException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.MOVE_TARGET_OUT_OF_BOUNDS:
raise MoveTargetOutOfBoundsException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.FRAME_SEND_NOT_INITIALIZED_ERROR:
raise FrameSendNotInitializedError(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.FRAME_SEND_FAILURE_ERROR:
raise FrameSendFailureError(message=message, status=status, stacktrace=stacktrace)
else:
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
raise MarionetteException(message=response, status=500)
def check_for_crash(self):
returncode = None
name = None
crashed = False
if self.emulator:
if self.emulator.check_for_crash():
returncode = self.emulator.proc.returncode
name = 'emulator'
crashed = True
if self.symbols_path and self.emulator.check_for_minidumps(self.symbols_path):
crashed = True
elif self.instance:
# In the future, a check for crashed Firefox processes
# should be here.
pass
if returncode is not None:
print ('PROCESS-CRASH | %s | abnormal termination with exit code %d' %
(name, returncode))
return crashed
def absolute_url(self, relative_url):
'''
Returns an absolute url for files served from Marionette's www directory.
:param relative_url: The url of a static file, relative to Marionette's www directory.
'''
return "%s%s" % (self.baseurl, relative_url)
def status(self):
return self._send_message('getStatus', 'value')
def start_session(self, desired_capabilities=None):
示例3: Marionette
# 需要导入模块: from emulator import Emulator [as 别名]
# 或者: from emulator.Emulator import check_for_crash [as 别名]
#.........这里部分代码省略.........
raise ElementNotVisibleException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_ELEMENT_STATE:
raise InvalidElementStateException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.UNKNOWN_ERROR:
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.ELEMENT_IS_NOT_SELECTABLE:
raise ElementNotSelectableException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.JAVASCRIPT_ERROR:
raise JavascriptException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.XPATH_LOOKUP_ERROR:
raise XPathLookupException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.TIMEOUT:
raise TimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_SUCH_WINDOW:
raise NoSuchWindowException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_COOKIE_DOMAIN:
raise InvalidCookieDomainException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.UNABLE_TO_SET_COOKIE:
raise UnableToSetCookieException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_ALERT_OPEN:
raise NoAlertPresentException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.SCRIPT_TIMEOUT:
raise ScriptTimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_SELECTOR \
or status == ErrorCodes.INVALID_XPATH_SELECTOR \
or status == ErrorCodes.INVALID_XPATH_SELECTOR_RETURN_TYPER:
raise InvalidSelectorException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.MOVE_TARGET_OUT_OF_BOUNDS:
MoveTargetOutOfBoundsException(message=message, status=status, stacktrace=stacktrace)
else:
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
raise MarionetteException(message=response, status=500)
def check_for_crash(self):
returncode = None
name = None
if self.emulator:
if self.emulator.check_for_crash():
returncode = self.emulator.proc.returncode
name = 'emulator'
elif self.instance:
# In the future, a check for crashed Firefox processes
# should be here.
pass
if returncode is not None:
print ('PROCESS-CRASH | %s | abnormal termination with exit code %d' %
(name, returncode))
return returncode is not None
def absolute_url(self, relative_url):
return "%s%s" % (self.baseurl, relative_url)
def status(self):
return self._send_message('getStatus', 'value')
def start_session(self, desired_capabilities=None):
# We are ignoring desired_capabilities, at least for now.
self.session = self._send_message('newSession', 'value')
self.b2g = 'b2g' in self.session
return self.session
@property
def test_name(self):
return self._test_name
@test_name.setter
示例4: Marionette
# 需要导入模块: from emulator import Emulator [as 别名]
# 或者: from emulator.Emulator import check_for_crash [as 别名]
#.........这里部分代码省略.........
raise ElementNotSelectableException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.JAVASCRIPT_ERROR:
raise JavascriptException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.XPATH_LOOKUP_ERROR:
raise XPathLookupException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.TIMEOUT:
raise TimeoutException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_SUCH_WINDOW:
raise NoSuchWindowException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.INVALID_COOKIE_DOMAIN:
raise InvalidCookieDomainException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.UNABLE_TO_SET_COOKIE:
raise UnableToSetCookieException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.NO_ALERT_OPEN:
raise NoAlertPresentException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.SCRIPT_TIMEOUT:
raise ScriptTimeoutException(message=message, status=status, stacktrace=stacktrace)
elif (
status == ErrorCodes.INVALID_SELECTOR
or status == ErrorCodes.INVALID_XPATH_SELECTOR
or status == ErrorCodes.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
raise InvalidSelectorException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.MOVE_TARGET_OUT_OF_BOUNDS:
raise MoveTargetOutOfBoundsException(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.FRAME_SEND_NOT_INITIALIZED_ERROR:
raise FrameSendNotInitializedError(message=message, status=status, stacktrace=stacktrace)
elif status == ErrorCodes.FRAME_SEND_FAILURE_ERROR:
raise FrameSendFailureError(message=message, status=status, stacktrace=stacktrace)
else:
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
raise MarionetteException(message=response, status=500)
def check_for_crash(self):
returncode = None
name = None
crashed = False
if self.emulator:
if self.emulator.check_for_crash():
returncode = self.emulator.proc.returncode
name = "emulator"
crashed = True
if self.symbols_path and self.emulator.check_for_minidumps(self.symbols_path):
crashed = True
elif self.instance:
# In the future, a check for crashed Firefox processes
# should be here.
pass
if returncode is not None:
print ("PROCESS-CRASH | %s | abnormal termination with exit code %d" % (name, returncode))
return crashed
def absolute_url(self, relative_url):
return "%s%s" % (self.baseurl, relative_url)
def status(self):
return self._send_message("getStatus", "value")
def start_session(self, desired_capabilities=None):
try:
# We are ignoring desired_capabilities, at least for now.
self.session = self._send_message("newSession", "value")
except:
exc, val, tb = sys.exc_info()
self.check_for_crash()