Trying to start up IE on watir-webdriver on windows xp, getting "Errno::EPERM: Operation not permitted - bind(2)", stacktrace points to 'port_prober' - ruby

So I'm on Windows XP, and I'm trying to get the watir-webdriver to run Internet Explorer 8. I've already added IEDriverServer.exe to the /bin for cygwin. I also disabled the windows firewall and anti-virus software temporarily, and am still getting this error message.
w = Watir::Browser.new :ie
#=>
Errno::EPERM: Operation not permitted - bind(2)
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:28:in `initialize' from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:28:in `new'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:28:in `block in free?' rom /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:26:in `each'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:26:in `free?'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:5:in `above'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/ie/bridge.rb:18:in `block in initialize'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/ie/bridge.rb:18:in `delete'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/ie/bridge.rb:18:in `initialize'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/driver.rb:35:in `new'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/driver.rb:35:in `for'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver.rb:67:in `for'
from /usr/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-webdriver/browser.rb:46:in `initialize'
from (irb):3:in `new'
Note the first time I ran this program, though it crashed immediately with the same error message, I got a dialog box from windows asking me if I wanted to block some action. I told it to "unblock" the action.

It seems your IE profile has some issue, better you remove IE and re-install it and then try to invoke the browser with you code, It should work.
Or try to update the IE that can also repair your browser.

Related

How to fix (RubyInstaller::Runtime::DllDirectory::WinApiError) in ruby on windows?

while Implementing ruby2d in the code i get this error
It's a strange runtime issue
Ruby2d Code
require 'ruby2d'
# Set the window size
set width: 300, height: 200
# Create a new shape
s = Square.new
# Give it some color
s.color = 'red'
# Show the window
show
Error
8: from R.rb:1:in `<main>'
7: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
6: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
5: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/ruby2d-0.5.1/lib/ruby2d.rb:28:in `<top (required)>'
3: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/singleton.rb:12:in `add_dll_directory'
2: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/singleton.rb:12:in `new'
1: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/dll_directory.rb:50:in `initialize'
*C:/Ruby25-
x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/dll_directory.rb:83:in
`add_dll_directory_winapi': AddDllDirectory failed for
C:/Users/Salim/usr/local/bin
(RubyInstaller::Runtime::DllDirectory::WinApiError)*
Please Help me to fix
You have to run your project from the MINGW 64-bit command prompt. Not from the regular DOS prompt (Windows Command Prompt).
Make sure you follow the instructions here:
http://www.ruby2d.com/learn/windows/
Note the last paragraph:
Using Ruby 2D on Windows
When working with Ruby 2D, make sure to use a MinGW 64-bit command prompt, rather than a standard one (cmd.exe) or the “Start Command Prompt with Ruby” found in the Start menu.
Fixed this issue by creating usr/local/bin folders in the C/users/username directory
and pasted the dlls required which can ne found on Link for dll
extract it and copy the dll from bin and paste in the new bin directory that you have created .
Imp- usr/local/bin was my default dll-load directory i hope its the same for others too but please check the error message properly.

Filling out form with Selenium works on Chrome but not Firefox

I'm trying to fill out a textarea using Selenium and ruby in Firefox, but for some reason, the code below doesn't work. When I switch the same script to Chrome driver though, it does work.
browser.textarea(:placeholder => "Add a comment…").set "#{randomly_chosen_comment}"
On firefox, I get this error:
/Users/miajohansson/.rvm/gems/ruby-2.2.4/gems/watir-6.10.3/lib/watir/elements/element.rb:623:in `raise_present': element located, but timed out after 30 seconds, waiting for #<Watir::TextArea: located: true; {:placeholder=>"Add a comment…", :tag_name=>"textarea"}> to be present (Watir::Exception::UnknownObjectException)
from /Users/miajohansson/.rvm/gems/ruby-2.2.4/gems/watir-6.10.3/lib/watir/elements/element.rb:669:in `rescue in element_call'
from /Users/miajohansson/.rvm/gems/ruby-2.2.4/gems/watir-6.10.3/lib/watir/elements/element.rb:680:in `element_call'
from /Users/miajohansson/.rvm/gems/ruby-2.2.4/gems/watir-6.10.3/lib/watir/user_editable.rb:11:in `set'
from instabot.rb:68:in `block (2 levels) in <main>'
from instabot.rb:36:in `each'
from instabot.rb:36:in `block in <main>'
from instabot.rb:35:in `loop'
from instabot.rb:35:in `<main>'
I've been working on this for many hours and I can't seem to figure out why it's not working. I need to get it to work on Firefox. Any help is very appreciated!!
I can't reproduce your issue; it is working for me without using the deprecated driver. Are you using the latest Firefox & geckodriver version?
One issue is that the dots are not periods, but different unicode; this will work with the latest geckodriver just fine:
browser.textarea(placeholder: /Add a comment/).set "#{randomly_chosen_comment}"
Or, because that is the first textarea on the page, you can just do:
browser.textarea.set "foo"

How to resolve unable to connect to chromedriver 127.0.0.1 in 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.

'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.

Watir-webdriver : text.include?("expected text") doesn't work in chrome browser

I use watir-webdriver for testing in Mac OS. As it is all to known that $browser.text.include?("expected text") is used to assert the text in the screen.
Currently this method works fine in Firefox and htmlunit, but will be fail in Chrome browser. Get the following error in the terminal windows.
Selenium::WebDriver::Error::UnhandledError:
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/response.rb:45:in `assert_ok'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/default.rb:56:in `request'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/bridge.rb:476:in `raw_execute'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/bridge.rb:454:in `execute'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/remote/bridge.rb:348:in `getElementText'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/element.rb:97:in `text'
/Users/Zhong/.rvm/gems/ruby-1.9.2-p180#ruby192/gems/watir-webdriver-0.2.4/lib/watir-webdriver/browser.rb:95:in `text'
Any idea of this? or is it a bug?
Thanks!
It's a bug in the Chrome driver with Chrome 14. Downgrade to Chrome 12-13 and you should be fine.

Resources