Filling out form with Selenium works on Chrome but not Firefox - ruby

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"

Related

Xcode Project Navigator, Cannot access Project

I am struggling a lot with this. And I know that the answer is staring me in the face somewhere but no matter what I search or look up and try, nothing works.
My schemes are all pointing to my pod frameworks and I cannot select the project target, even if I try and add a new scheme or edit an old one.
My project navigator starts with a folder as shown above, and I have NO idea how to revert back to whatever I had done to get it like this.
If anyone has any suggestions please help.
I cannot access target build settings or project build settings, Is there a way to access them without going through the project navigator ?
I cannot build properly as shown from the schemes, is there an easy fix to this ? Have I somehow changed the target path to an incorrect file location? How to revert back ?
I'm stuck :(
UPDATE:
deleting the .xcworkspace file and reinstalling the podfile gives below error code.
```
RuntimeError - [Xcodeproj] Unknown object version.
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project.rb:218:in `initialize_from_file'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project.rb:103:in `open'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/analyzer.rb:918:in `block (2 levels) in inspect_targets_to_integrate'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/analyzer.rb:917:in `each'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/analyzer.rb:917:in `block in inspect_targets_to_integrate'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/user_interface.rb:64:in `section'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/analyzer.rb:912:in `inspect_targets_to_integrate'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/analyzer.rb:78:in `analyze'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer.rb:243:in `analyze'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/user_interface.rb:64:in `section'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/installer.rb:116:in `install!'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/command/install.rb:41:in `run'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/command.rb:52:in `run'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/bin/pod:55:in `<top (required)>'
/Applications/CocoaPods.app/Contents/Resources/bundle/bin/pod:22:in `load'
/Applications/CocoaPods.app/Contents/Resources/bundle/bin/pod:22:in `<main>'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version.&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- RuntimeError - [Xcodeproj] Unknown object version.
https://github.com/CocoaPods/CocoaPods/issues/6992 [closed] [16 comments]
31 Jan 2019
- - ERROR | [iOS] unknown: Encountered an unknown error (Malformed version number string ) during validation.
https://github.com/CocoaPods/CocoaPods/issues/8240 [closed] [16 comments]
12 hours ago
- Xcodeproj doesn't know about the following attributes {"inputFileListPaths"=>[], "outputFileListPaths"=>[]} for the 'PBXShellScriptBuildPhase' isa
https://github.com/CocoaPods/CocoaPods/issues/7835 [closed] [46 comments]
2 hours ago
and 44 more at:
https://github.com/cocoapods/cocoapods/search?q=%5BXcodeproj%5D%20Unknown%20object%20version.&type=Issues&ut
SOLUTION:
To my particularly specific problem, I had permission issues with the RUBYGEMS that is installed by default on all MAC devices.
I was not able to rebase my project to its original state as I did not have "write privileges". I had to install homebrew and rbenv which allowed me to (after deleting my cocoapods out of the project entirely) rebase my project to its original state before whatever I had done to rebase the file target to something else.
After installing Homebrew and Rbenv I installed a newer version of RubyGem which gave me admin permissions on the new install. Then I reinstalled cocoapods to the project and VOILA. Problem solved.

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

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

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.

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.

Ruby Rspec outputs literal escape characters on windows

I'm following the ruby on rails tutorial: http://railstutorial.org/chapters/static-pages#top
I'm up to using rspec. Having installed the win32console gem, it outputs gibberish in the console, i assume it is outputting the ansi colour change codes:
>rspec spec/
?[31mF?[0m?[31mF?[0m
Finished in 0.34376 seconds
?[31m2 examples, 2 failures?[0m
1) PagesController GET 'home' should be successful
Failure/Error: Unable to find C to read failed line
?[31mundefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x22294e0>?[0m
?[90m # ./spec/controllers/pages_controller_spec.rb:7:in `block (3 levels) in <top (required)>'?[0m
2) PagesController GET 'contact' should be successful
Failure/Error: Unable to find C to read failed line
?[31mundefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2:0x2173d28>?[0m
?[90m # ./spec/controllers/pages_controller_spec.rb:14:in `block (3 levels) in <top (required)>'?[0m
Any tips how to fix this?
Ansicon works a treat!
http://adoxa.110mb.com/ansicon/index.html
Download, extract it somewhere, and do:
ansicon -i
Then close/reopen the command prompt. Sweet!
There was a bug in beta releases of RSpec 2. If you upgrade to latest you should now see colors if you have win32console installed.
See this: http://github.com/rspec/rspec-core/issuesearch?state=closed&q=color#issue/143
UPDATE: Keep an eye on this thread:
http://groups.google.com/group/rubyinstaller/browse_thread/thread/2d2a62db7281509a/?pli=1
Update:
Rspec is still very buggy with windows coloring, especially if you're trying to use it with Autotest and/or Spork.
If you are still seeing escape codes, a quick hack is to edit the following file (exact path will depend on your version of RSpec)
%RUBY_HOME%\lib\ruby\gems\1.9.1\gems\rspec-core-2.0.1\bin\rspec
And add the following line
require 'win32console'

Resources