Commit 45778f34 authored by Romain Bignon's avatar Romain Bignon

fix command 'inspect' to don't crash if there isn't any browser

parent 7d356f50
......@@ -818,10 +818,13 @@ class ReplApplication(Cmd, ConsoleApplication):
print >>sys.stderr, 'No backend found for "%s"' % backend_name
return 1
backend = backends.pop()
if not hasattr(backend, '_browser'):
print >>sys.stderr, 'No browser created for backend "%s" yet. Please invoke a command before.' % backend.name
if not backend.browser:
print >>sys.stderr, 'No browser created for backend "%s".' % backend.name
return 1
browser = backend._browser
if not backend.browser.page:
print >>sys.stderr, 'The browser of %s is not on any page.' % backend.name
return 1
browser = backend.browser
data = browser.parser.tostring(browser.page.document)
try:
from webkit_mechanize_browser.browser import Browser
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment