Ruby code for configuring Selenium to access JavaScript console -


what correct ruby code configuring selenium access javascript console (i.e., messages writing using console.log, console.error, console.info, etc.)?

i've found several articles java, python, , c# code; but, i'm having trouble getting right ruby.

here best guess firefox:

  caps = selenium::webdriver::remote::capabilities.chrome   caps[:loggingpref] = {:browser => :all}   return selenium::webdriver.for :firefox, :desired_capabilities => caps 

this code doesn't appear affect (i logging messages, not generated console.log, console.error, etc.). therefore, suspect have spelled wrong, or symbol need string.

chrome provide access console.info, console.error, , console.warn messages default. not show console.log messages. assume there similar technique configuring chrome driver return messages; but, again, can't find right combination of keys, values, symbols, , strings make work.

the capability called :logging_prefs in ruby , :browser parameter string value.

here's code (you quite close!):

caps = selenium::webdriver::remote::capabilities.firefox caps[:logging_prefs] = {:browser => "all"} return selenium::webdriver.for :firefox, :desired_capabilities => caps 

then can log messages driver.manage.logs.get(:browser)


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -