I am trying to submit a form in this url "http://www.paisabazaar.com/personal-loan" using ruby (watir-webdriver gem) script . I'm able to fill the form using the script but im not able to click on the checkbox and the submit button.
Following are the specifications
chrome=54.0.2840.71
chromedriver=2.25.426923
watir-webdriver (0.9.3, 0.9.1)
ruby version= ruby 2.2.4p230 (2015-12-16 revision 53155) [x64-mingw32]
gem version= 2.6.8
OS=windows 7
Script:
require 'watir-webdriver'
$browser=Watir::Browser.new :chrome
$browser.goto "http://www.paisabazaar.com/personal-loan"
$browser.text_field(:id,'loan_amount').send_keys "400000"
$browser.text_field(:id,'monthly_income').send_keys "90000"
$browser.text_field(:id,'email').send_keys "xyz#domain.com"
$browser.text_field(:id,'mobile_number').send_keys "898989898989"
$browser.button(:id,'submit_first_step').click
Error:
Selenium::WebDriver::Error::UnknownError: unknown error: Right-hand side of 'instanceof' is not callable
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/response.rb:70:in `assert_ok'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:389:in `clickElement'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/element.rb:73:in `click'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:128:in `block in click'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:598:in `element_call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:117:in `click'
from (irb):7
from C:/Ruby22-x64/bin/irb:11:in `<main>'
This error occurs only with the click method (checked in irb). Please check and let me know whats happening and solution for this issue. Thank you in advance.
It appears to be an unresolved bug in chromedriver. https://bugs.chromium.org/p/chromedriver/issues/detail?id=1388
I recommend adding your reproducible test case there.
Related
I'm trying to migrate very old script to ruby 2.7, gem seems to be installed correctly but its throwing out error i am assuming that error is because the script is expecting PG gem version to be 0.9.0 but for some reason on ruby 2.7 this is version is not getting installed and its installing 1.2.3 and dbd-pg calls pg gem so that might be causing this issue.
here is the trace:
Trace: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:81:in `rescue in initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:40:in `initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb:157:in `new'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb:157:in `connect'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbi-0.4.4/lib/dbi/handles/driver.rb:33:in `connect'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbi-0.4.4/lib/dbi.rb:148:in `connect'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:212:in `check_database_exists'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:222:in `check_already_set_up'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:71:in `set_up_databases'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:404:in `block in <main>'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:386:in `each'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:386:in `<main>'.
PS: I never worked on Ruby so any input is welcome. This is first time we are working with ruby and we are not much familiar with the errors or call stacks.
Thanks in advance
I have a simple code and similar code for :chrome, :ie, :ff works fine.
require 'watir'
b = Watir::Browser.new :edge
My environment:
ruby 2.4
watir 6.10.3
selenium-webdriver 3.11
proper webdriver is downloaded and put into path (I matched the system version with the version of the driver)
As result I got error:
Selenium::WebDriver::Error::WebDriverError: unexpected response, code=500, content-type="text/plain"
Unknown error
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/common.rb:88:in `create_response'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/default.rb:104:in `request'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/remote/bridge.rb:97:in `create_session'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/edge/driver.rb:51:in `initialize'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/driver.rb:54:in `new'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/driver.rb:54:in `for'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver.rb:85:in `for'
from c:/Ruby24/lib/ruby/gems/2.4.0/gems/watir-6.10.3/lib/watir/browser.rb:48:in `initialize'
from (irb):19:in `new'
from (irb):19
from C:/Ruby24/bin/irb.cmd:19:in `<main>'
What's wrong?
UPDATE: This code works fine for EDGE at home, but fail at workstation. It seems some network or security configuration
Trying to build a gem like so.
gem build my-awesome-theme.gemspec
And for some unknown reason it's throwing the following error.
/Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:249:in `write': closed stream (IOError)
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:249:in `close'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:87:in `ensure in new'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package/tar_writer.rb:87:in `new'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:231:in `block in build'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:230:in `open'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:230:in `build'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/package.rb:111:in `build'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/commands/build_command.rb:48:in `execute'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/command.rb:305:in `invoke_with_build_args'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/command_manager.rb:167:in `process_args'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/command_manager.rb:137:in `run'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/gem_runner.rb:54:in `run'
from /Users/robertrawlins/.rvm/rubies/ruby-2.3.1/bin/gem:21:in `<main>'
Have tried complete rebuild of the ruby environment using RVM, and fresh clone of the gem source from GitHub but the problem persists.
Running Mac OSX, RVM and Ruby 2.3.1
Any help greatly received. :)
Thanks to some help on the #ruby-lang IRC channel I managed to track this issue to an outdated version of rubygems, bumped it from 2.2 to 2.6 and problem appears to have gone away.
My system configurations Windows 7, IE8
when I try to open the firefox browser I got the following error can anyone help me how to resolve these.
C:\Users\khan>irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir-webdriver'
=> true
irb(main):003:0> e=Watir::Browser.new :firefox
NoMethodError: undefined method `ascii_only?' for {}:Hash
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/pure/generator.rb:393:in `to_json'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/multi_json-1.3.7/lib/multi_json/adapters/json_common.rb:11:in `dump'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/multi_json-1.3.7/lib/multi_json.rb:115:in `dump'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/json_helper.rb:23:in `json_dump'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:254:in `write_prefs'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:253:in `each'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:253:in `write_prefs'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:252:in `open'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:252:in `write_prefs'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:232:in `update_user_prefs_in'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/profile.rb:79:in `layout_on_disk'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/launcher.rb:58:in `create_profile'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/launcher.rb:34:in `launch'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/socket_lock.rb:20:in `locked'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/launcher.rb:32:in `launch'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/firefox/bridge.rb:20:in `initialize'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/driver.rb:31:in `new'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/driver.rb:31:in `for'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver.rb:67:in `for'
from D:/Ruby_1.8.7/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.2/lib/watir-webdriver/browser.rb:46:in `initialize'
from (irb):3:in `new'
from (irb):3
from ♥:0irb(main):004:0>
Based on the exception, you are using an older version of selenium-webdriver and watir-webdriver. It is possible that there is an incompatibility between your selenium-webdriver gem and your Firefox version.
Therefore, I would suggest upgrading your gems:
gem install selenium-webdriver
gem install watir-webdriver
It might also be possible that one of the dependencies is also incompatible (eg json-pure where the exception occurs). You might want to trying updating everything.
gem update
You should try to update gem,I am not sure about it,but try once.
gem update --system
I have installed JRuby 1.6.7.2 (64bit), and the JDK 1.7.x (64-bit) on my Windows 7 machine. Right now I'm just trying to launch a browser (Firefox 13.0) using Watir but I keep getting an HTTP error that seems to be coming internally from JRuby + gems. I have installed the gems using the following commands:
jgem install watir-webdriver
jgem install rspec
jgem install capybara
jgem install page-object
jgem install bundler
jgem install jruby-jars
Here is the stacktrace error I get when I try to open a browser using Watir:
C:\Windows\System32>jirb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir-webdriver'
=> true
irb(main):003:0> b = Watir::Browser.start("http://www.google.com", :firefox)
[WARNING] MultiJson is using the default adapter (ok_json). We recommend loading
a different JSON library to improve performance.
ArgumentError: HTTP request path is empty
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/net/http.rb:1476:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/net/http.rb:1594:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/default.rb:64:in `new_request_for'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/default.rb:34:in `request'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/default.rb:57:in `request'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/firefox/bridge.rb:28:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/common/driver.rb:31:in `for'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver.rb:65:in `for'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/
lib/watir-webdriver/browser.rb:35:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/
lib/watir-webdriver/browser.rb:18:in `start'
from (irb):3:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1183:in `catch'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:70:in `start'
from C:\Ruby\jruby-1.6.7.2\bin\jirb:13:in `(root)'irb(main):004:0>
I have the selenium webdrivers ie & chrome added to my classpath. When I execute this command with ie or chrome I get a similar HTTP error. Is this a fix I have to do manually to the gem files?
I had the same error with the watir-webdriver gem.
The problem were the http proxy settings and the solution was to add the no_proxy env before the code.
ENV['no_proxy'] = "127.0.0.1"
I hope that can help you!