javascript - not getting browser logs when using phantomjs driver -


in selenium test cases, have added special assert ensure code under test didn't generate errors in browser console. implement such thing, i'm capturing browser logs , seeing if there log entries log level > info.

i'm able browser logs using chrome or firefox when running selenium testing, when test configured follows (example below phantomjs):

loggingpreferences logs = new loggingpreferences(); logs.enable(logtype.browser, level.all); desiredcapabilities caps = desiredcapabilities.phantomjs(); caps.setcapability(capabilitytype.logging_prefs, logs); driver = new phantomjsdriver(caps); 

however when using phantomjs, don't logs, i.e. following expression returns 0:

driver.manage().logs().get(logtype.browser).getall().size() 

configuration:

  • selenium: 2.45.0
  • phantomjs: 1.9.8
  • os: mac-10.10 (yosemite)-32bit
  • phantomjs driver: 1.2.1 (using "com.codeborne" % "phantomjsdriver" % "1.2.1")
  • ghostdriver 1.1.0

when querying available log types, via:

driver.manage().logs().getavailablelogtypes() 

i get: [har, browser, client], 'har' , 'client' have logentries.

here below output when executing test. notice there indeed few page.onerror (what m trying catch, via logs) should part of captured browser logs.

can see what's wrong in driver setup?

looking @ unit test: https://github.com/detro/ghostdriver/blob/master/test/java/src/test/java/ghostdriver/logtest.java, should working, must wrong in setup (code or libraries), not able spot it.

thanks!

apr 29, 2015 1:24:35 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: executable: /tmp/phantomjs-1.9.8-macosx/bin/phantomjs apr 29, 2015 1:24:35 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: port: 8208 apr 29, 2015 1:24:35 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: arguments: [--webdriver=8208, --webdriver-logfile=/tmp/phantomjsdriver.log] apr 29, 2015 1:24:35 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: environment: {} phantomjs launching ghostdriver... [info - 2015-04-29t11:24:36.729z] ghostdriver - main - running on port 8208 [info - 2015-04-29t11:24:37.222z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.settings - {"xssauditingenabled":false,"javascriptcanclosewindows":true,"javascriptcanopenwindows":true,"javascriptenabled":true,"loadimages":true,"localtoremoteurlaccessenabled":false,"useragent":"mozilla/5.0 (macintosh; intel mac os x) applewebkit/534.34 (khtml, gecko) phantomjs/1.9.8 safari/534.34","websecurityenabled":true} [info - 2015-04-29t11:24:37.222z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.customheaders: - {} [info - 2015-04-29t11:24:37.222z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - session.negotiatedcapabilities - {"browsername":"phantomjs","version":"1.9.8","drivername":"ghostdriver","driverversion":"1.1.0","platform":"mac-10.10 (yosemite)-32bit","javascriptenabled":true,"takesscreenshot":true,"handlesalerts":false,"databaseenabled":false,"locationcontextenabled":false,"applicationcacheenabled":false,"browserconnectionenabled":false,"cssselectorsenabled":true,"webstorageenabled":false,"rotatable":false,"acceptsslcerts":false,"nativeevents":true,"proxy":{"proxytype":"direct"}} [info - 2015-04-29t11:24:37.222z] sessionmanagerreqhand - _postnewsessioncommand - new session created: 51a8f330-ee62-11e4-b50f-c5e60b20f37e running selenium org.openqa.selenium.phantomjs.phantomjsdriver [info] application - elasticsearch @ localhost:9300 [error - 2015-04-29t11:24:39.523z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.onerror - msg: error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [] http://errors.angularjs.org/1.3.15/$rootscope/infdig?p0=10&p1=%5b%5d [error - 2015-04-29t11:24:39.523z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.onerror - stack: (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26446) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26668) bootstrapapply (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13555) invoke (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:16300) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13556) bootstrap (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13570) angularinit (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13464) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:38401) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:3048) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:3160) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:433) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:104) [error - 2015-04-29t11:24:39.535z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.onerror - msg: error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [] http://errors.angularjs.org/1.3.15/$rootscope/infdig?p0=10&p1=%5b%5d [error - 2015-04-29t11:24:39.535z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.onerror - stack: (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26446) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26668) done (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21795) completerequest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21985) requestloaded (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21930) [error - 2015-04-29t11:24:39.551z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.onerror - msg: error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [] http://errors.angularjs.org/1.3.15/$rootscope/infdig?p0=10&p1=%5b%5d [error - 2015-04-29t11:24:39.551z] session [51a8f330-ee62-11e4-b50f-c5e60b20f37e] - page.onerror - stack: (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26446) (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26668) done (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21795) completerequest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21985) requestloaded (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21930)

edit

ran same tests using phantomjs 2.0 (from https://github.com/eugene1g/phantomjs/releases official release crashes on os x yosemite). same results (see log below).

apr 30, 2015 12:39:14 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: executable: <...>/documents/phantomjs-2.0/phantomjs apr 30, 2015 12:39:14 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: port: 42987 apr 30, 2015 12:39:14 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: arguments: [--webdriver=42987, --webdriver-logfile=<...>/phantomjsdriver.log] apr 30, 2015 12:39:14 pm org.openqa.selenium.phantomjs.phantomjsdriverservice <init> info: environment: {} [info  - 2015-04-30t10:39:15.103z] ghostdriver - main - running on port 42987 [info  - 2015-04-30t10:39:15.468z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.settings - {"xssauditingenabled":false,"javascriptcanclosewindows":true,"javascriptcanopenwindows":true,"javascriptenabled":true,"loadimages":true,"localtoremoteurlaccessenabled":false,"useragent":"mozilla/5.0 (macintosh; intel mac os x) applewebkit/538.1 (khtml, gecko) phantomjs/2.0.0 safari/538.1","websecurityenabled":true} [info  - 2015-04-30t10:39:15.468z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.customheaders:  - {} [info  - 2015-04-30t10:39:15.468z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - session.negotiatedcapabilities - {"browsername":"phantomjs","version":"2.0.0","drivername":"ghostdriver","driverversion":"1.2.0","platform":"mac-10.9 (mavericks)-64bit","javascriptenabled":true,"takesscreenshot":true,"handlesalerts":false,"databaseenabled":false,"locationcontextenabled":false,"applicationcacheenabled":false,"browserconnectionenabled":false,"cssselectorsenabled":true,"webstorageenabled":false,"rotatable":false,"acceptsslcerts":false,"nativeevents":true,"proxy":{"proxytype":"direct"}} [info  - 2015-04-30t10:39:15.468z] sessionmanagerreqhand - _postnewsessioncommand - new session created: 25c7d880-ef25-11e4-a0e9-4d6ab124ffa3 running selenium org.openqa.selenium.phantomjs.phantomjsdriver [info] application - elasticsearch @ localhost:9300 [error - 2015-04-30t10:39:18.825z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.onerror - msg: error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [] http://errors.angularjs.org/1.3.15/$rootscope/infdig?p0=10&p1=%5b%5d     @ $digest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26446:31)     @ $apply (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26668:31)     @ bootstrapapply (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13552:21)     @ invoke (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:16300:22)     @ dobootstrap (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13550:20)     @ bootstrap (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13570:23)     @ angularinit (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:13464:14)     @ http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:38401:16     @ fire (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:3048:35)     @ firewith (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:3160:11)     @ ready (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:433:24)     @ completed (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:104:16)    :262 in error [error - 2015-04-30t10:39:18.825z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.onerror - stack:   (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:23752)    :262 in error [error - 2015-04-30t10:39:18.832z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.onerror - msg: error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [] http://errors.angularjs.org/1.3.15/$rootscope/infdig?p0=10&p1=%5b%5d     @ $digest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26446:31)     @ $apply (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26668:31)     @ done (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21795:53)     @ completerequest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21985:15)     @ requestloaded (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21926:24)    :262 in error [error - 2015-04-30t10:39:18.832z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.onerror - stack:   (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:23752)    :262 in error [error - 2015-04-30t10:39:18.839z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.onerror - msg: error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [] http://errors.angularjs.org/1.3.15/$rootscope/infdig?p0=10&p1=%5b%5d     @ $digest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26446:31)     @ $apply (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:26668:31)     @ done (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21795:53)     @ completerequest (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21985:15)     @ requestloaded (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:21926:24)    :262 in error [error - 2015-04-30t10:39:18.839z] session [25c7d880-ef25-11e4-a0e9-4d6ab124ffa3] - page.onerror - stack:   (anonymous function) (http://localhost:3333/assets/bundles/js/vendor-6fac01f5.js:23752)    :262 in error --------------- 0 [info  - 2015-04-30t10:39:19.105z] shutdownreqhand - _handle - shutdown 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -