How to resolve unable to connect to chromedriver 127.0.0.1 in ruby - ruby

I am using chrome driver 2.35(tried till v 2.9) and chrome browser v 65.
gems used:
watir 6.10.3
selenium-webdriver 3.11.0
error message:
Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9515
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/service.rb:142:in `connect_until_stable'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/service.rb:72:in `block in start'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/socket_lock.rb:39:in `locked'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/service.rb:69:in `start'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/chrome/driver.rb:42:in `initialize'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/driver.rb:44:in `new'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver/common/driver.rb:44:in `for'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.11.0/lib/selenium/webdriver.rb:85:in `for'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.10.3/lib/watir/browser.rb:48:in `initialize'

I downgraded the chrome version to 62 and disabled auto update to resolve this issue.
Older version available here
Before installing the older version some steps needs to be followed.
Uninstall current version of chrome
Navigate to C:\Users\\AppData\Local and delete google
directory
Navigate to C:\Program Files (x86) and delete google directory
Install the intended older version
Don't open the chrome browser,chrome gets updated automatically.
Type 'msconfig' in run command and ensure google update services are in 'stopped' status
Navigate to 'C:\Program Files (x86)\Google' and rename 'update'
directory to some other name.If renaming is denied ensure that all
chrome related tasks are closed in task manager and then try
renaming.
Now open chrome and navigate to Help->About Google Chrome.If you get
a error message for update then chrome won't get updated.

I had the same issue, unable to connect chromedriver. So instead of using different chrome driver versions, I have just added gem called chromedriver-helper to my gem list, now works fine.

Related

Compatible Ruby and Cocoapods versions

I am developing a Flutter app for Android and iOS. The app is in a stable state of development on the Android simulator so I thought I would try to run it on the iOS simulator. The Flutter installation process on Macos requires installing Cocoapods. After trying to use the Macos installation of Ruby and encountering permission errors, I decided to try asdf, the latest version of Ruby (Ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin21]), and Cocoapods (1.11.2). The installation appeared to be successful, but running pod results in the following error:
Error loading the plugin cocoapods-plugins-1.0.0.
NoMethodError - undefined method activate' for #<Gem::StubSpecification:0x00007f963819f4f8 #extension_dir=nil, #full_gem_path="/Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/cocoapods-plugins-1.0.0", #gem_dir=nil, #ignored=nil, #loaded_from="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/specifications/cocoapods-plugins-1.0.0.gemspec", #data=#<Gem::StubSpecification::StubLine:0x00007f9638194850 #name="cocoapods-plugins", #version=#<Gem::Version "1.0.0">, #platform="ruby", #extensions=[], #full_name="cocoapods-plugins-1.0.0", #require_paths=["lib"]>, #name=nil, #spec=#<Gem::Specification:0x00007f96381cc278 #extension_dir=nil, #full_gem_path="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/cocoapods-plugins-1.0.0", #gem_dir=nil, #ignored=nil, #bin_dir=nil, #cache_dir=nil, #cache_file=nil, #doc_dir=nil, #ri_dir=nil, #spec_dir=nil, #spec_file=nil, #gems_dir="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems", #base_dir="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0", #loaded=true, #activated=true, #loaded_from="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/specifications/cocoapods-plugins-1.0.0.gemspec", #original_platform=nil, #installed_by_version=#<Gem::Version "3.3.2">, #autorequire=nil, #date=2016-05-10 00:00:00 UTC, #description=" This CocoaPods plugin shows information about all available CocoaPods plugins\n (yes, this is very meta!).\n This CP plugin adds the \"pod plugins\" command to CocoaPods so that you can list\n all plugins (registered in the reference JSON hosted at CocoaPods/cocoapods-plugins)\n", #email=nil, #homepage="https://github.com/cocoapods/cocoapods-plugins", #name="cocoapods-plugins", #post_install_message=nil, #signing_key=nil, #summary="CocoaPods plugin which shows info about available CocoaPods plugins.", #version=#<Gem::Version "1.0.0">, #authors=["David Grandinetti", "Olivier Halligon"], #bindir="bin", #cert_chain=[], #dependencies=[<Gem::Dependency type=:runtime name="nap" requirements=">= 0">, <Gem::Dependency type=:development name="bundler" requirements="~> 1.3">, <Gem::Dependency type=:development name="rake" requirements=">= 0">], #executables=[], #extensions=[], #extra_rdoc_files=[], #files=[], #licenses=["MIT"], #metadata={}, #platform="ruby", #rdoc_options=[], #require_paths=["lib"], #required_ruby_version=#<Gem::Requirement:0x00007f96381d7b28 #requirements=[[">=", #<Gem::Version "2.0.0">]]>, #required_rubygems_version=#<Gem::Requirement:0x00007f96381d7ee8 #requirements=[[">=", #<Gem::Version "0">]]>, #requirements=[], #rubygems_version="3.3.2", #specification_version=4, #test_files=[], #new_platform="ruby", #full_name="cocoapods-plugins-1.0.0", #full_require_paths=["/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/cocoapods-plugins-1.0.0/lib"] cocoapods-plugins-1.0.0>, #base_dir="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0", #gems_dir="/Users/kevin/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems", #default_gem=false, #activated=true> Did you mean? activated? /Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:93:in safe_activate_and_require'
/Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:31:in block in load_plugins' /Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:30:in map'
/Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:30:in load_plugins' /Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command.rb:326:in block in run'
/Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command.rb:325:in each' /Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.0.3/lib/claide/command.rb:325:in run'
/Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in run' /Users/xyz/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/cocoapods-1.11.2/bin/pod:55:in <top (required)>'
/Users/xyz/.asdf/installs/ruby/3.0.3/bin/pod:25:in load' /Users/xyz/.asdf/installs/ruby/3.0.3/bin/pod:25:in '
I do not need a fix. I just want to know versions of Ruby and Cocoapods that are compatible and allow me to make progress on developing my Flutter app on Macos.
After I posted the above issue, others encountered the same problem as reported here: https://github.com/CocoaPods/CocoaPods/issues/11134
The workaround for the problem is to use Ruby 2.7.5. After installing that version, I found Cocoapods 1.11.2 is compatible with Ruby 2.7.5.
brew install ruby#2.7
export PATH="/usr/local/opt/ruby#2.7/bin:$PATH"

Unicorn+Sinatra+Nginx | FATAL error adding listener

I have a Sinatra application hosted using Nginx and Unicorn. it went down when I upgraded the operating system (Ubuntu 14.04.5 LTS) on the server, and I was able to bring them all back up except this one, the lone Rack-based application. When I try to launch Unicorn (unicorn -c unicorn.rb -D), I get the following error:
I, [2017-08-06T15:39:54.426004 #6505] INFO -- : unlinking existing socket=/tmp/unicorn.wheels-within-wheels.sock
F, [2017-08-06T15:39:54.427777 #6505] FATAL -- : error adding listener addr=/tmp/unicorn.wheels-within-wheels.sock
/home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/socket_helper.rb:113:in `unlink': Operation not permitted # unlink_internal - /tmp/unicorn.wheels-within-wheels.sock (Errno::EPERM)
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/socket_helper.rb:113:in `$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/socket_helper.rb:107:in `$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:231:in `li$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:808:in `bl$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:808:in `ea$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:808:in `bi$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:130:in `st$
from /home/deployer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.2.0/bin/unicorn:126:in `<top (required)>'
from /home/deployer/.rbenv/versions/2.2.3/bin/unicorn:23:in `load'
from /home/deployer/.rbenv/versions/2.2.3/bin/unicorn:23:in `<main>'
Anyone have an idea on how to fix this? Thanks.
It's fixed after I performed the following two steps:
As described in this Server Fault answer, I changed the group of the application owner, 'deployer', from 'deployer' to 'staff'.
I changed the owner of the socket file to deployer:staff (sudo chown deployer:staff /tmp/unicorn.wheels-within-wheels.sock).
Then I ran bundle update to update the gems, and finally Unicorn ran successfully and the application was live again.
The following link said that kind of problem is occured upgrading MacOSX to El Capitan. if you can follow the same path, maybe you could resolve the problem.
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted

'Learn Ruby on Rails' tutorial: Can't submit contact form

I am getting the error below following the tutorial in the book Learn Ruby on Rails.
I am able to launch my app manually by typing the URL into my browser but am wondering why Heroku open does not work.
Any idea what is happening here?
Heroku open error...
$ heroku open
Opening peaks-app... failed
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: Unable to find a browser command. If this is unexpected, Please rerun with environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at
https://github.com/copiousfreetime/launchy/issues/new (Launchy::CommandNotFoundError)
Backtrace: /home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy/applications/browser.rb:63:in `browser_cmdline'
/home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy/applications/browser.rb:67:in `cmd_and_args'
/home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy/applications/browser.rb:78:in `open'
/home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy.rb:29:in `open'
/home/action/.heroku/client/lib/heroku/helpers.rb:328:in `block in launchy'
/home/action/.heroku/client/lib/heroku/helpers.rb:227:in `action'
/home/action/.heroku/client/lib/heroku/helpers.rb:326:in `launchy'
/home/action/.heroku/client/lib/heroku/command/apps.rb:342:in `open'
/home/action/.heroku/client/lib/heroku/command.rb:217:in `run'
/home/action/.heroku/client/lib/heroku/cli.rb:33:in `start'
/home/action/.parts/bin/heroku:24:in `<main>'
Command: heroku open
Version: heroku-toolbelt/3.12.1 (x86_64-linux) ruby/2.1.1
The short answer is that Heroku uses Launchy to launch my app and Launchy is looking for my browser. Since I am using Nitrous.io, I do not have a browser installed, so Launchy does not know what to do.
The author of Launchy explains that "...launching a browser from within the virtual box would do nothing if there was no browser installed." https://github.com/copiousfreetime/launchy/issues/78
Launching manually appears to be my only option at this point.

Heroku throws error when deploying my app. Can't make sense of it

My GIT commit and push commands go through successfully, but my application fails to start, and tells me there has been a server error. I have checked the Heroku server status and it is operating at optimum performance.
Here is the error I found in my logs:
C:/Documents and Settings/Administrator/.heroku/client/lib/heroku/updater.rb:155
:in `spawn': No such file or directory - C:/Program Files/Heroku/bin/heroku upda
te (Errno::ENOENT)
from C:/Documents and Settings/Administrator/.heroku/client/lib/heroku/u
pdater.rb:155:in `background_update!'
from C:/Program Files/Heroku/lib/heroku/updater.rb:135:in `inject_libpat
h'
from C:/Program Files/Heroku/bin/heroku:19:in `<main>'
I don't understand what this means. Can you please help me?
The problem seems to be with the 2.32.13 version. Removing this version and installing the 2.32.14 solved the issue on Windows XP.
according to this post (on Ubuntu) removing and installing should fix the problem

Problem connecting to localhost with watir

I have a set of cucumber tests that normally run fine against our site. But if I make any changes and want to run the tests locally, the tests fail immediately, even before the initial page is finished loading.
I tried in IRB without cucumber and get the same error, using the following code:
require 'rubygems'
require 'watir'
browser = Watir::Browser.new
browser.goto("http://localhost:1234/somepath")
browser.text_field(:id, 'Username').set('jimbob')
Which fails with the following:
WIN32OLERuntimeError: unknown property or method `document'
HRESULT error code:0x800706b5
The interface is unknown.
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/ie-class.rb:467:in `method_missing'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/ie-class.rb:467:in `document'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/container.rb:836:in `locate_input_element'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/input_elements.rb:5:in `locate'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/element.rb:55:in `assert_exists'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/input_elements.rb:366:in `set'
Versions:
OS: Windows 7
Browser: IE8
Ruby: 1.8.7 (I tried using 1.9.2, but it didn't have a problem)
Watir: 1.7.1
You need to run as Administrator on Windows 7 when using Watir against localhost.
Credit to http://chowamigo.blogspot.com/2010/03/setting-up-cucumber-to-use-watir-test.html
Same thing applies to Server2008 btw gotta run the command line window as admin in order for watir to work correctly. Something to do with IE security I'm sure.

Resources