Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method log for Selenium::WebDriver::Remote::W3C::Bridge #5127

Closed
shepmaster opened this issue Nov 27, 2017 · 9 comments
Closed

Undefined method log for Selenium::WebDriver::Remote::W3C::Bridge #5127

shepmaster opened this issue Nov 27, 2017 · 9 comments

Comments

@shepmaster
Copy link

Meta -

OS: macOS 10.13.1 (17B48)
Selenium Version: selenium-webdriver 3.7.0
GeckoDriver Version: 0.19.1
Browser: Firefox
Browser Version: 57.0

Expected Behavior -

I am able to access the JavaScript console logs.

Actual Behavior -

An exception is raised:

Exception: NoMethodError: undefined method `log' for #<Selenium::WebDriver::Remote::W3C::Bridge:0x007f9e66d31dd0>
--
 0: .../gems/selenium-webdriver-3.7.0/lib/selenium/webdriver/common/logs.rb:30:in `get'

Steps to reproduce -

repro.rb

require 'rubygems'
require 'webdrivers'
require 'selenium-webdriver'

driver = Selenium::WebDriver.for :firefox
driver.get "http://google.com"

errors = driver.manage.logs.get(:browser)
puts errors

driver.quit

Gemfile

# frozen_string_literal: true
source "https://rubygems.org"

gem "webdrivers", '3.2.2'
gem "selenium-webdriver", '3.7.0'
bundle exec ruby ./repro.rb
@titusfortner
Copy link
Member

That endpoint isn't in the w3c and likely won't be supported by Firefox.
To get browser/driver logs for Firefox, set it in the capabilities:
http://www.rubydoc.info/gems/selenium-webdriver/3.7.0/Selenium/WebDriver/Firefox/Options
what is available is here:
https://github.com/mozilla/geckodriver#log-object

@shepmaster
Copy link
Author

shepmaster commented Nov 27, 2017

@titusfortner thank you. Both of your links seem to be about how to set the logging level; I'm missing how to actually programmatically retrieve the logs. Any hints?

@shepmaster
Copy link
Author

I think that mozilla/geckodriver#284 is the issue you refer to with "likely won't be supported by Firefox"

@shepmaster
Copy link
Author

You may also want to close #1161 then?

@titusfortner
Copy link
Member

@shepmaster you don't see it in STDOUT?

@lmtierney
Copy link
Member

@titusfortner @shepmaster is referring to the browser console logs, which are not supported by gecko/firefox at this time as the spec does not define them. It is a possibility for the future.

@shepmaster
Copy link
Author

@lmtierney is correct — I want to add assertions to my tests that no console warnings were logged during the run. Thank you both for your help!

@sdhull
Copy link

sdhull commented Aug 25, 2018

@shepmaster did you find a solution to accomplish this? I want to do the same.

@shepmaster
Copy link
Author

@sdhull I did not. I think you wish to follow mozilla/geckodriver#284.

@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants