Open pdehaan opened 6 years ago
I'm a bit confused. I'm getting zero successes and zero failures. Almost all the error message looking texts seem to point towards Activity Stream, but not sure if that is just coincidence since it may be one of the first things loaded.
It works for me, do you see the browser displaying a page ? Are you able to run geckodriver manually?
OK, I must be missing some setup piece... In one tab, I'm running geckodriver@0.19.1:
$ geckodriver --version # geckodriver 0.19.1
$ geckodriver
1524507302157 geckodriver INFO geckodriver 0.19.1
1524507302177 geckodriver INFO Listening on 127.0.0.1:4444
In another tab, I'm trying to run this test; loadtest3.py:
# loadtest3.py
from molosonic import setup_browser, teardown_browser
import molotov
@molotov.setup_session()
async def _setup_session(wid, session):
print("----- setup_session()")
await setup_browser(session)
@molotov.teardown_session()
async def _teardown_session(wid, session):
print("~~~~~ teardown_session")
await teardown_browser(session)
@molotov.scenario(1)
async def example(session):
print("!!!!!! test case")
firefox = session.browser
# go to example.com
await firefox.get('https://www.google.com')
# wait up to 5 seconds to get the h1 element from the page
h1 = await firefox.wait_for_element(10, 'input')
# print the text of the h1 element
print(await h1.get_text())
$ molotov -c --verbose -p 1 -d 1 -w 1 ./loadtest3.py
**** Molotov v1.6. Happy breaking! ****
Preparing 1 worker...
----- setup_session()
OK
1524508594380| Fgeckodriver| WORINFO: 0 geckodriver 0.20.0
1524508594397 geckodriver INFO Listening on 127.0.0.1:57331
2018-04-23 11:36.34 request body={"desiredCapabilities": {"browserName": "firefox", "marionette": true, "acceptInsecureCerts": true}} method=POST url=http://localhost:57331/session
1524508594828 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/qc/g_f0szh95k1fzph34rhmf5jw0000gp/T/rust_mozprofile.z2fGIEYP26LB"
Unable to read VR Path Registry from /Users/pdehaan/Library/Application Support/OpenVR/.openvr/openvrpaths.vrpath
Unable to read VR Path Registry from /Users/pdehaan/Library/Application Support/OpenVR/.openvr/openvrpaths.vrpath
2018-04-23 11:36:37.031 plugin-container[57173:35342237] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x7a3f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
1524508597851| FMarionette | WORINFO: 1 Listening on port 57341
1524508597879 Marionette WARN TLS certificate errors will be ignored for this session
2018-04-23 11:36.37 response body={"desiredCapabilities": {"browserName": "firefox", "marionette": true, "acceptInsecureCerts": true}} data={'value': {'sessionId': 'b2f13d5a-f987-9144-8c4f-5e79a9ae5c6b', 'capabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'browserVersion': '60.0', 'moz:accessibilityChecks': False, 'moz:headless': False, 'moz:processID': 57172, 'moz:profile': '/var/folders/qc/g_f0szh95k1fzph34rhmf5jw0000gp/T/rust_mozprofile.z2fGIEYP26LB', 'moz:useNonSpecCompliantPointerOrigin': False, 'moz:webdriverClick': True, 'pageLoadStrategy': 'normal', 'platformName': 'darwin', 'platformVersion': '17.5.0', 'rotatable': False, 'timeouts': {'implicit': 0, 'pageLoad': 300000, 'script': 30000}}}} method=POST response=<ClientResponse(http://127.0.0.1:57331/session) [200 OK]>
<CIMultiDictProxy('Connection': 'close', 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache', 'Content-Length': '551', 'Date': 'Mon, 23 Apr 2018 18:36:37 GMT')>
url=http://localhost:57331/session
~~~~~ teardown_session
2018-04-23 11:36.37 request body=None method=DELETE url=http://localhost:57331/session/b2f13d5a-f987-9144-8c4f-5e79a9ae5c6b
1524508597958 addons.xpi WARN Exception running bootstrap method shutdown on activity-stream@mozilla.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://activity-stream/lib/SnippetsFeed.jsm :: uninit :: line 185" data: no] Stack trace: uninit()@resource://activity-stream/lib/SnippetsFeed.jsm:185
onAction()@resource://activity-stream/lib/SnippetsFeed.jsm:201
_middleware/</<()@resource://activity-stream/lib/Store.jsm:49
Store/this[method]()@resource://activity-stream/lib/Store.jsm:28
uninit()@resource://activity-stream/lib/Store.jsm:151
uninit()@resource://activity-stream/lib/ActivityStream.jsm:294
uninit()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Applications/Firefox.app/Contents/Resources/browser/features/activity-stream@mozilla.org.xpi!/bootstrap.js:73
shutdown()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Applications/Firefox.app/Contents/Resources/browser/features/activity-stream@mozilla.org.xpi!/bootstrap.js:169
callBootstrapMethod()@resource://gre/modules/addons/XPIProvider.jsm:4436
observe()@resource://gre/modules/addons/XPIProvider.jsm:2287
GeckoDriver.prototype.quit()@driver.js:3300
despatch()@server.js:293
execute()@server.js:267
onPacket/<()@server.js:242
onPacket()@server.js:241
_onJSONObjectReady/<()@transport.js:500
JavaScript error: resource://gre/modules/JSONFile.jsm, line 159: Error: Data is not ready.
JavaScript error: resource://gre/modules/JSONFile.jsm, line 159: Error: Data is not ready.
JavaScript error: resource://gre/modules/JSONFile.jsm, line 159: Error: Data is not ready.
JavaScript error: resource://pdf.js/PdfJs.jsm, line 247: NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: [JavaScript Error: "Data is not ready." {file: "resource://gre/modules/JSONFile.jsm" line: 159}]'[JavaScript Error: "Data is not ready." {file: "resource://gre/modules/JSONFile.jsm" line: 159}]' when calling method: [nsIHandlerService::store]
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping
JavaScript error: resource://gre/modules/osfile/osfile_async_front.jsm, line 408: Error: OS.File has been shut down. Rejecting post to DirectoryIterator_prototype_close
JavaScript error: resource://gre/modules/osfile/osfile_async_front.jsm, line 408: Error: OS.File has been shut down. Rejecting post to DirectoryIterator_prototype_close
JavaScript error: resource://gre/modules/ProfileAge.jsm, line 174: Error: Unable to fetch oldest profile entry: Error: OS.File has been shut down. Rejecting post to DirectoryIterator_prototype_next
JavaScript error: resource://gre/modules/ProfileAge.jsm, line 174: Error: Unable to fetch oldest profile entry: Error: OS.File has been shut down. Rejecting post to DirectoryIterator_prototype_next
1524508598635| Fgeckodriver::marionette ERROR Failed to stop browser process
2018-04-23 11:36.38 response body=None data={'value': {}} method=DELETE response=<ClientResponse(http://127.0.0.1:57331/session/b2f13d5a-f987-9144-8c4f-5e79a9ae5c6b) [200 OK]>
<CIMultiDictProxy('Connection': 'close', 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache', 'Content-Length': '13', 'Date': 'Mon, 23 Apr 2018 18:36:38 GMT')>
url=http://localhost:57331/session/b2f13d5a-f987-9144-8c4f-5e79a9ae5c6b
SUCCESSES: 0 | FAILURES: 0
*** Bye ***
When I run molotov, I briefly see a new Firefox browser instance launch, but then it quickly closes. From the console dump, I can see setup_session()
and teardown_session()
getting called, but I never see my test case getting invoked.
You don't need to run geckodriver, setup_browser does it for you and it needs to, so it knows which port to use. Let's add more logging!
@molotov.setup_session()
async def _setup_session(wid, session):
print("----- setup_session()")
await setup_browser(session)
print("browser was set!")
print(str(session.browser))
Also, let's add some in molosonic guts. In the start() function:
https://github.com/tarekziade/molosonic/blob/master/molosonic/__init__.py#L75
let's add a print after every line. one of them is not functionning in your case.
Sorry for this issue, it's hard since I can't reproduce. If that last attempt fails, we should meet and do it live!
Same results w/ a fresh $ pip install git+https://github.com/tarekziade/molosonic.git@master --upgrade:
# cat ./loadtest3.py
from molosonic import setup_browser, teardown_browser
import molotov
@molotov.setup_session()
async def _setup_session(wid, session):
print("----- setup_session()\n\n")
await setup_browser(session)
print("browser was set!\n\n")
print(str(session.browser))
@molotov.teardown_session()
async def _teardown_session(wid, session):
print("~~~~~ teardown_session\n\n")
await teardown_browser(session)
@molotov.scenario(1)
async def example(session):
print("!!!!!! test case\n\n")
firefox = session.browser
# go to example.com
print("aaaaaa\n\n")
await firefox.get('https://www.google.com')
# wait up to 5 seconds to get the h1 element from the page
print("bbbbbb\n\n")
h1 = await firefox.wait_for_element(10, 'input')
# print the text of the h1 element
print(await h1.get_text())
$ molotov -c --verbose -p 1 -d 1 -w 1 ./loadtest3.py | pbcopy
**** Molotov v1.6. Happy breaking! ****
Preparing 1 worker...
----- setup_session()
OK
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 0
1524580863733 geckodriver INFO geckodriver 0.20.0
1524580863739 geckodriver INFO Listening on 127.0.0.1:56593
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
2018-04-24 07:41.04 request body={"desiredCapabilities": {"browserName": "firefox", "marionette": true, "acceptInsecureCerts": true}} method=POST url=http://localhost:56593/session
1524580864193 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/qc/g_f0szh95k1fzph34rhmf5jw0000gp/T/rust_mozprofile.SEfk9o0fvFvQ"
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
Unable to read VR Path Registry from /Users/pdehaan/Library/Application Support/OpenVR/.openvr/openvrpaths.vrpath
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
Unable to read VR Path Registry from /Users/pdehaan/Library/Application Support/OpenVR/.openvr/openvrpaths.vrpath
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
2018-04-24 07:41:05.702 plugin-container[75546:36936920] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x803f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
1524580866181 Marionette INFO Listening on port 56599
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
1524580866308 Marionette WARN TLS certificate errors will be ignored for this session
2018-04-24 07:41.06 response body={"desiredCapabilities": {"browserName": "firefox", "marionette": true, "acceptInsecureCerts": true}} data={'value': {'sessionId': '9d3cd7cd-614b-b743-9932-4276140f8a84', 'capabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'browserVersion': '60.0', 'moz:accessibilityChecks': False, 'moz:headless': False, 'moz:processID': 75545, 'moz:profile': '/var/folders/qc/g_f0szh95k1fzph34rhmf5jw0000gp/T/rust_mozprofile.SEfk9o0fvFvQ', 'moz:useNonSpecCompliantPointerOrigin': False, 'moz:webdriverClick': True, 'pageLoadStrategy': 'normal', 'platformName': 'darwin', 'platformVersion': '17.5.0', 'rotatable': False, 'timeouts': {'implicit': 0, 'pageLoad': 300000, 'script': 30000}}}} method=POST response=<ClientResponse(http://127.0.0.1:56593/session) [200 OK]>
<CIMultiDictProxy('Connection': 'close', 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache', 'Content-Length': '551', 'Date': 'Tue, 24 Apr 2018 14:41:06 GMT')>
url=http://localhost:56593/session
browser was set!
<arsenic.session.Session object at 0x10f6c2240>
~~~~~ teardown_session
2018-04-24 07:41.06 request body=None method=DELETE url=http://localhost:56593/session/9d3cd7cd-614b-b743-9932-4276140f8a84
1524580866399 addons.xpi WARN Exception running bootstrap method shutdown on activity-stream@mozilla.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://activity-stream/lib/SnippetsFeed.jsm :: uninit :: line 185" data: no] Stack trace: uninit()@resource://activity-stream/lib/SnippetsFeed.jsm:185
onAction()@resource://activity-stream/lib/SnippetsFeed.jsm:201
_middleware/</<()@resource://activity-stream/lib/Store.jsm:49
Store/this[method]()@resource://activity-stream/lib/Store.jsm:28
uninit()@resource://activity-stream/lib/Store.jsm:151
uninit()@resource://activity-stream/lib/ActivityStream.jsm:294
uninit()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Applications/Firefox.app/Contents/Resources/browser/features/activity-stream@mozilla.org.xpi!/bootstrap.js:73
shutdown()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Applications/Firefox.app/Contents/Resources/browser/features/activity-stream@mozilla.org.xpi!/bootstrap.js:169
callBootstrapMethod()@resource://gre/modules/addons/XPIProvider.jsm:4436
observe()@resource://gre/modules/addons/XPIProvider.jsm:2287
GeckoDriver.prototype.quit()@driver.js:3300
despatch()@server.js:293
execute()@server.js:267
onPacket/<()@server.js:242
onPacket()@server.js:241
_onJSONObjectReady/<()@transport.js:500
Unable to read VR Path Registry from /Users/pdehaan/Library/Application Support/OpenVR/.openvr/openvrpaths.vrpath
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
SUCCESSES: 0 | FAILURES: 0 | WORKERS: 1
1524580867071 geckodriver::marionette ERROR Failed to stop browser process
2018-04-24 07:41.07 response body=None data={'value': {}} method=DELETE response=<ClientResponse(http://127.0.0.1:56593/session/9d3cd7cd-614b-b743-9932-4276140f8a84) [200 OK]>
<CIMultiDictProxy('Connection': 'close', 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache', 'Content-Length': '13', 'Date': 'Tue, 24 Apr 2018 14:41:07 GMT')>
url=http://localhost:56593/session/9d3cd7cd-614b-b743-9932-4276140f8a84
SUCCESSES: 0 | FAILURES: 0
*** Bye ***
Digging through the output dump above, I was able to call Firefox from my Terminal using the following:
$ "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/qc/g_f0szh95k1fzph34rhmf5jw0000gp/T/rust_mozprofile.SEfk9o0fvFvQ"
So it looks like I can launch a browser no problem. Just a bit odd that the only debugging output I see was:
----- setup_session()
browser was set!
~~~~~ teardown_session
... but it doesn't even log anything from my @molotov.scenario(1)
.
$ "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-profile" "/var/folders/qc/g_f0szh95k1fzph34rhmf5jw0000gp/T/rust_mozprofile.0NpQJYafDYZ9" --version
# Mozilla Firefox 60.0
Actually, we can probably ignore me. Something is weird, but it's probably just me. Your sample.py would never work for me, because I can't seem to resolve "example.com" in my browser.
But if I use this modified version (your GitHub repo), I am able to extract all text on the page:
from molosonic import setup_browser, teardown_browser
import molotov
@molotov.setup_session()
async def _setup_session(wid, session):
await setup_browser(session)
@molotov.teardown_session()
async def _teardown_session(wid, session):
await teardown_browser(session)
@molotov.scenario(1)
async def example(session):
firefox = session.browser
# go to example.com
await firefox.get('https://github.com/tarekziade/molosonic')
# wait up to 5 seconds to get the h1 element from the page
h1 = await firefox.wait_for_element(5, 'div.application-main')
# print the text of the h1 element
print("!!!!!!!!!!" + await h1.get_text() + "@@@@@@@@@")
$ molotov --max-runs 1 simple.py
I'll keep digging into my test case and try and figure out why it's failing, but the modified sample file is working.
oh... interesting. I guess some error is not bubbling up. Thanks for digging ! I probably have enough to reproduce
Re: https://github.com/tarekziade/molosonic/blob/master/examples/simple.py I'm using a venv w/ Python 3.6 and installing molosonic via Git, and get a pretty verbose debug dump when trying to run the /examples/simple.py file via $ molotov -c --verbose -p 1 -d 1 -w 1 ./simple.py: