undefined method `execute_script' in page object gem - ruby

I have started to get this error when running my tests using the 1.2.2 version of the page object gem
Stacktrace
undefined method `execute_script' for <Selenium::WebDriver::Firefox::Bridge:0x00000003cbdba0> (NoMethodError)
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/element.rb:146:in `parent'
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/table_row.rb:30:in `find_index_by_title'
/usr/lib64/ruby/gems/2.2.0/gems/page-object-1.2.2/lib/page-object/platforms/selenium_webdriver/table_row.rb:15:in `[]'
It occurs when trying to get the value from a table using a method such as
left_table_element[rank][column]
NB. This had been previously working for over a year so I wonder if a new issue has been introduced?
Looking at the git blame it does seem like the line of code throwing the error in the element.rb might have been changed recently and maybe caused this regression?

The problem is due a change in Selenium-WebDriver. In version 3.0.0, the Remote::Bridge#executeScript method was renamed to #execute_script.
The Page-Object gem was updated in version 1.2.2 to use the new method. However, the gem dependencies were not updated to reflect the required version - ie Selenium-WebDriver v2.53.4 is still listed as the minimum requirement. It looks like this has already been fixed in the eventual Page-Object v2.0 release.
In the meantime, you can fix the issue by upgrading to Selenium-WebDriver v3 (assuming you do not want to downgrade Page-Object):
gem install selenium-webdriver

To fix this issue just need to update your page-object gem to 1.2.2 version
gem install -v 1.2.2 (for selenium-webdriver 3.x only)

Related

enforcing a ruby gem version

I am completely new to ruby, don't know the 1st thing about rvm, gemset etc. Just forced to use a CLI tool (kensa by heroku) written in ruby and facing an issue.
The kensa tool seems to use a gem named rest-client. When I run it it throws an error:
/Users/shaharsol/.rvm/gems/ruby-2.4.2/gems/rest-client-1.8.0/lib/restclient/request.rb:163:in `fetch': key not found: :ciphers (KeyError)
Some searches suggest that v1.8 of rest-client is too old so I installed v2.0.2. Now when I do a gem list I get:
rest-client (2.0.2, 1.8.0)
When I run kensa again it still used to old version. So I went and modified it kensa.gemspec file (which is referred to from Gemfile) and to my best understanding told it to use the newer version:
s.add_runtime_dependency(%q<rest-client>, "~> 2.0")
Yet, when I run kensa again, it still uses the old rest-client 1.8.0!
What am I missing? What am I doing wrong? Or what else is required for the kensa to run with the new rest-client 2.0.2 ???
PS - If my problem doesn't relate at all to changing 1.8.0 => 2.0.2 please tell me what else to do. I really don't care which rest-client version kensa uses, I just need it to run!
To remove older version of the gem, you have two options:
# remove all versions of the gem
gem cleanup rest-client
After this, you can do 'bundle install' and only install the version you want.
# choose which one you want to remove
gem uninstall rest-client --version 1.8.0
After this, you will only have 2.0.2 version.
Hope this solves your problem.

Ruby 2.2.2 - Time zone reference

I just upgraded to Ruby v 2.2.2.
Now, when I start my console, I get this error:
.rvm/gems/ruby-2.2.2/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
Loading development environment (Rails 4.0.2)
I don't know what it means or how to fix it. I don't have a file called time_zone.rb in my application, so I assume its something that is incorporated by reference.
Does anyone know what to do to resolve this?
I see that you are using Rails in your project. You just need to upgrade your Rails version to 4.1.9.
This issue was fixed in these commits:
fix ruby 2.2 warning: circular argument reference
use self.method syntax to resolve circular argument issues
You can upgrade the Rails version in your Gemfile or Gemfile.lock files.
Gemfile
gem "rails", "4.1.9"
Gemfile.lock
rails (4.1.9)
Be sure to run bundle after you make these changes!

Twitter gem usage - Faraday builder error

I’m trying to use twitter gem and getting
Faraday::Builder is now Faraday::RackBuilder
when I run the code. Anybody else got this or have idea how to resolve it
I resolved this error by upgrading twitter gem to current stable. Seems like you use old version and it calls Faraday::Builder instead of Faraday::RackBuilder, which triggers this warning.
So there are 2 possible solutions:
To upgrade twitter gem version to stable, which uses Faraday::RackBuilder
To downgrade faraday gem version, where you suppose to use Faraday::Builder(0.8.x if I remember correctly)

Symbol lookup error since upgrading to Ruby 2.2.0

I got this error, since upgrading to 2.2.0, only happened when a http request sent to puma:
puma 2.10.2 (tcp://0.0.0.0:22555): symbol lookup error:
/usr/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/do_postgres-0.10.14/do_postgres/do_postgres.so:
undefined symbol: rb_thread_select
What are the cause and how to fix this?
Downgrading to 2.1.5 fixes this problem anyway.
The pg gem prior to version 0.14.1 uses the method rb_thread_select. This method was removed in Ruby 2.2. According to their history file, version 0.15.0 released in March 2013 does not use it anymore:
== v0.15.0 [2013-03-03] Michael Granger <ged#FaerieMUD.org>
[...]
Enhancements:
- Make use of rb_thread_fd_select() on Ruby 1.9 and avoid deprecated
rb_thread_select().
[...]
So you may be using an old pg gem. Upgrading this gem to at least 0.15.0 should fix your issue.

Issues using the latest Psych with Rails 3.2.8 & ruby 1.9.3

I recently hit some JSON parse issues and discovered we are using a pretty old version of Psych and libyaml: Psych version: 1.2.2; Psych libyaml version: 0.1.4
The latest Psych has much better JSON parsing support (subset of YAML) and I verified this fixes my issues, however I'm having issues configuring our Rails app to use the latest Psych gem versus the Psych version bundled with ruby.
I simply add gem 'psych' in the gemfile and run bundle install according to the online docs.
Now when I try to run anything I hit errors:
uninitialized constant Psych::Streaming::ClassMethods (NameError)
While it makes no sense, I know whats going on here, internally Rails is using the OLD version of Psych::Streaming which doesn't have these new methods. When I debug I see it using the old dir (e.g. ~Ruby1.9.3\lib\ruby\1.9.1\psych\streaming.rb) versus the NEW lib it should be using (e.g. ~Ruby1.9.3\lib\ruby\gems\1.9.1\gems\psych-2.0.8\lib\psych\streaming.rb)
So this seems like general confusion where code in the new Psych gem is calling code from the old bundled Psych version. How do I get Rails to not use the old bundled version and use the latest Psych??
We're using an older version of Rails (3.2.8) and ruby (1.9.3-p125) and unfortunately upgrading is not an option for the project right now...
** UPDATE **
It seems like root causing this problem will be a nightmare so maybe I need a new approach. Is there a way to ONLY use the latest Psych gem in my new code, but let everything else (like the external ruby libs) continue using the old bundled version? We had no issues with the old Psych version until I started passing around & parsing more complex JSON in my new code...

Resources