undefined method executeScript' for <Selenium::WebDriver::Chrome::Bridge:0x007ffd0fa16e90> Did you mean? execute_script (NoMethodError)
I'm getting this error on any line with element.fire_event('onClick')
Chrome version 53.0.2785.143 (64-bit)
ChromeDriver 2.24.417412
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
I'm using selenium-webdriver/page object.. I defined my element..
checkbox(:check_the_box, :id => 'checkboxid')
then tried to execute a fire_event on it..
check_the_box_element.fire_event('onClick')
then i receive the error above.
undefined method `executeScript' for # Did you mean? execute_script (NoMethodError)
Exception clearly states, It should be WebDriver#execute_script(script, *args) instead
Related
I Don't know anything about Ruby, found code below which reports AWS status
https://gist.github.com/ktheory/1604786
/1.rb https://status.aws.amazon.com/rss/a4b-us-east-1.rss
Error fetching status: undefined method `text' for nil:NilClass
ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
latest_status = xml_doc.css("item title").first.text
print lastest_status
in `<main>': undefined method `text' for nil:NilClass (NoMethodError)
If first comes up empty and returns nil you can't just blunder along or your code will crash. You need to tread carefully:
latest_status = xml_doc.css("item title").first&.text
Or, if you're using an older version of Ruby and have ActiveSupport from Rails:
latest_status = xml_doc.css("item title").first.try(:text)
Or else you're going to need to do it the hard way:
latest_status = xml_doc.css("item title").first
latest_status &&= latest_status.text
You should probably figure out why that selector isn't working as it might not be correct and ends up returning nothing.
Hi i am tryng to installs rails for the first time, following steps given in http://installrails.com/. But I am facing this problem when I give this command in git bash
curl http://installrails.com/update_rubygems.rb | ruby
this error comes up:
Downloading ...
-:55:in 'filename': undefined method 'split' for nil:NilClass <NoMethodError>
from -:25:in 'download'
from -:14:in 'call'
from -:60:in '<main>'
This question already has an answer here:
In Ruby, why does nil[1]=1 evaluate to nil?
(1 answer)
Closed 6 years ago.
Since ruby 2.3.0, you can call []= method on nil. I don't understand the purpose of this method.
For instance:
nil[1] = 1
# or
nil['foo'] = 'bar'
but [] method does not exist:
nil[1]
# => NoMethodError: undefined method `[]' for nil:NilClass
The ruby 2.3.0 changelog does not mention that changes, although it seems close to the safe navigation operator.
What is the purpose of this operator?
That seems to be actually a bug in 2.3.0 - https://bugs.ruby-lang.org/issues/11976
It does not evaluate the arguments:
nil[undefined_index_variable] = raise "Fooo!" # => nil
That method isn't documented in Ruby 2.3.0 and I cannot reproduce this behavior in Ruby 2.3.1 (both examples raise NoMethodError: undefined method '[]=' for nil:NilClass).
Furthermore I reinstalled 2.3.0 and was only partly able to reproduce your examples:
$ rbenv install 2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...
Installed ruby-2.3.0 to /Users/spickermann/.rbenv/versions/2.3.0
$ rbenv shell 2.3.0
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
$ irb
irb > RUBY_VERSION
irb => "2.3.0"
irb > nil[1] = 1
irb => nil
irb > nil['foo'] = 'bar'
NoMethodError: undefined method `[]=' for nil:NilClass
from (irb):3
from /Users/spickermann/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'
It seems like NilClass#[]= doesn't work properly in Ruby 2.3.0. Since it was completely removed in 2.3.1, I guess that this method or this behavior was added by accident.
Update: Cary Swoveland pointed out in a comment on another question that this behavior was a bug and was fixed in later versions (see: https://bugs.ruby-lang.org/issues/11976).
NoMethodError: undefined method 'perform' for nil:nilClass
The message above is what I'm getting from my command line. This is after a type in my path and then the sass --watch input.scss:output.css then it returns the above error message.
SASS version: 3.2.14
Ruby version: 2.0.0 (The most recent version)
Windows 8
Using a localhost and a testing server.
I need help! :)
Hi this is "usually" a problem with your sass code and not with the compiler itself. Track back a few steps and see if you added any unusual code like IE filters etc.
You can refer here for more
Sass error on compilation NoMethodError: undefined method `count' for nil:NilClass Use --trace for backtrace
How can I stop rake --tasks from aborting? Has 'split' been deprecated?
It is outputting this error... (full trace)
[rake --tasks] rake aborted!
undefined method `split' for nil:NilClass
/Users/Crimbo/.rvm/rubies/jruby-1.7.5/lib/ruby/gems/shared/gems/rake-10.1.0/lib/rake/task.rb:297:in `first_sentence'
.
.
.
Lines in question... task.rb (full text)
296 def first_sentence(string)
297 string.split(/\.[ \t]|\.$|\n/).first
298 end
299 private :first_sentence
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.5' | rails (3.2.14) | rake (10.1.0)
The split method is not deprecated. But in your case the string seems to be nil. Please check what you are passing to the method first_sentence.
EDIT:
This seems to be an issue in rake gem itself. Please check this url,
https://github.com/jimweirich/rake/issues/220
But, the gem owner feels that this is valid and suggests the users to use rake -T --all instead.
Patch Solution
If you wish to still use rake --tasks, follow what Amit Thawait stated...
Use to_s method in the task.rb, so that it does not throw the error undefined method 'split' for nil:NilClass
def first_sentence(string)
string.to_s.split(/\.[ \t]|\.$|\n/).first
end
private :first_sentence
As a safety measure, you should use to_s method, so that it doesn't throws error as undefined method 'split' for nil:NilClass
def first_sentence(string)
string.to_s.split(/\.[ \t]|\.$|\n/).first
end
private :first_sentence