Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Print Browser console logs using Cucumber Ruby Automation?

Can you please help on printing the console logs generate in web browser for any errors in Cucumber Capybara Test Automation? I am using PhantomJS webdriver as below:

Capybara::Selenium::Driver.new(app, :browser => :phantomjs, desired_capabilities: { 'phantomjs.cli.args' => ['--ignore-ssl-errors=yes']

I want to capture Browser JS console logs and print it while i need on automation execution

like image 893
SaeeK Avatar asked Dec 15 '22 09:12

SaeeK


1 Answers

Since you're using selenium you can try

page.driver.browser.manage.logs.get("browser")

Note: I've never tried it with PhantomJS as the browser

like image 182
Thomas Walpole Avatar answered May 10 '23 15:05

Thomas Walpole