kroe761 kroe761 - 10 months ago 55
Ruby Question

((undefined method ` ' NoMethodError)) when using applitools EYES in Ruby/Selenium

I am simply trying to set a constant on the Eyes class, but I get a very strange error. It works when setting the API key, but setting any other constant (like

, or
see documentation)) gives me the error below. I don't know what I'm doing differently than when I'm setting the API key. Thanks for your help!


require 'selenium-webdriver'
require 'eyes_selenium'

Before do |scenario|

$driver = Selenium::WebDriver.for :chrome
$driver.manage.window.resize_to(1050, 900)
@eyes =
@eyes.api_key = 'my_api_key'
@eyes.save_new_tests = true # <-- Errors here 'my_app', test_name: scenario.title, driver: $driver)



undefined method `  ' for #<Object:0x007fdc778eb740> (NoMethodError)
./features/support/env.rb:10:in `Before'

Answer Source
▶ '  '.codepoints
#⇒ [
#    [0] 8194,
#    [1] 8194
# ]

The above is a result of me copy-pasting the content of “undefined method” from your error description.

That said, you accidentally have entered unicode en-space (possibly with AltGrSPACE on MacOS, or copy-paste from some web example.) Retype the line manually and everything should work as intended.