axemclion / browser-perf

Performance Metrics for Web Browsers
BSD 2-Clause "Simplified" License
937 stars 61 forks source link

The environment you requested was unavailable #59

Closed hypery2k closed 8 years ago

hypery2k commented 8 years ago

If the selenium grid is not available you get the following misleading error:

browser-perf https://google.com --verbose
  bp:index Selenium is on localhost +0ms
  bp:metrics Initializing Metrics +3ms
  bp:probes Registering probe +237ms PerfLogProbe
  bp:probes:AndroidTracingProbe Initialize +4ms
  bp:probes Registering probe +0ms AndroidTracingProbe
  bp:probes Registering probe +4ms PerfLogProbe
  bp:probes Registering probe +1ms AndroidTracingProbe
  bp:probes Registering probe +4ms RafBenchmarkingProbe
  bp:probes Registering probe +3ms NavTimingProbe
  bp:probes Registering probe +3ms NetworkResourcesProbe
  bp:metrics TimelineMetrics +2ms setup called
  bp:metrics ChromeTracingMetrics +1ms setup called
  bp:metrics NetworkResources +0ms setup called
  bp:probes setup +1ms
  bp:probes PerfLogProbe +0ms setup called
  bp:probes AndroidTracingProbe +0ms setup called
  bp:probes NetworkResourcesProbe +1ms setup called
  bp:index Stating browser with +1ms {"browserName":"chrome","version":35,"chromeOptions":{"perfLoggingPrefs":{"traceCategories":",blink.console,devtools.timeline,disabled-by-default-devtools.timeline,toplevel,disabled-by-default-devtools.timeline.frame,benchmark"},"args":["--enable-gpu-benchmarking","--enable-thread-composting"]},"loggingPrefs":{"performance":"ALL"}}
  bp:selenium CALL +1ms init({"browserName":"chrome","version":35,"chromeOptions":{"perfLoggin
  bp:selenium CALL +42ms quit()
  bp:selenium RESPONSE +11ms quit()
[ { [Error: [init({"browserName":"chrome","version":35,"chromeOptions":{"perfLoggingPrefs":{"traceCategories":",blink.console,devtools.timeline,disabled-by-default-devtools.timeline,toplevel,disabled-by-default-devtools.timeline.frame,benchmark"},"args":["--enable-gpu-benchmarking","--enable-thread-composting"]},"loggingPrefs":{"performance":"ALL"}})] The environment you requested was unavailable.] data: '' } ]
Error: [init({"browserName":"chrome","version":35,"chromeOptions":{"perfLoggingPrefs":{"traceCategories":",blink.console,devtools.timeline,disabled-by-default-devtools.timeline,toplevel,disabled-by-default-devtools.timeline.frame,benchmark"},"args":["--enable-gpu-benchmarking","--enable-thread-composting"]},"loggingPrefs":{"performance":"ALL"}})] The environment you requested was unavailable.
    at /usr/local/lib/node_modules/browser-perf/node_modules/wd/lib/webdriver.js:129:15
    at Request._callback (/usr/local/lib/node_modules/browser-perf/node_modules/wd/lib/http-utils.js:87:7)
    at Request.self.callback (/usr/local/lib/node_modules/browser-perf/node_modules/wd/node_modules/request/request.js:368:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/browser-perf/node_modules/wd/node_modules/request/request.js:1219:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/browser-perf/node_modules/wd/node_modules/request/request.js:1167:12)
    at emitNone (events.js:72:20)
hypery2k commented 8 years ago

see https://github.com/admc/wd/blob/v0.4.0/lib/webdriver.js#L129

axemclion commented 8 years ago

@hypery2k What do you think would be the best solution to this ? This is also the same error that you get if you don't have the browser.

I am not sure how best to solve this issue - are you suggesting that we need a better error message ?

hypery2k commented 8 years ago

I propose some change for improved error handling. Take a look. Some of the tests are failing, but i'm not sure why

axemclion commented 8 years ago

@hypery2k Will this only happen when you are not able to reach the selenium server? In other cases (like trying to test IE on Mac), will the error be different ?

hypery2k commented 8 years ago

the error will currently only appear if the grid connected is refused. So you only be if not reaching the selenium server

axemclion commented 8 years ago

In the error message, should we say - could not reach the "selenium server" instead of "grid" ?

hypery2k commented 8 years ago

yes you're right ;)

axemclion commented 8 years ago

@hypery2k I fixed the name, and merged your PR. Thanks a lot for that. Closing this issue.

imranansari commented 7 years ago

is this merged into 1.4.11 ?, I'm getting the same error

axemclion commented 7 years ago

@imranansari Are you able to run this with just selenium ? Can you set DEBUG=* as environment variable, and see what the logs say ?