I'm getting undefined method 'send_keys' when running feature tests in our Ruby on Rails application we've been using over the past 3 years when trying to run our rspec-capybara tests
We have the gem 'selenium-webdriver', '~> 2.47.1' in our Gemfile and it shows in Gemfile.lock
we suspect we're not using the right driver but given our Gemfile, not sure why not
HTML we're targeting:
<input class="zip-code-input" id="landing-zip-code" maxlength="5" name="landing[zip_code]"
pattern="[0-9]*" placeholder="ZIP Code" size="5" tabindex="1" title="Five-Digit ZIP Code"
value="" type="text">
I see a lot of references to rack in the Gemfile.lock, i.e.
$ bundle | grep rack
Using rack 1.4.7
Using crack 0.3.2
Using rack-cache 1.5.1
Using rack-test 0.6.3
Using rack-ssl 1.3.4
Using rack-protection 1.5.3
Using rack_session_access 0.1.1
but I've been unable to find any way to change that
send_keys is documented here:
https://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Element.html#send_keys-instance_method
If you are using capybara gem and if you are trying to fill the text field, then you have to use the below syntax.
fill_in 'landing-zip-code', with: '123456'
Find the reference here
Related
I'm trying to get Guard to detect file system changes while I'm working with SASS files. I want them to be compiled to CSS. I don't want to interact with the terminal every time I make a change though. It should just happen automatically. Right now, I have to press enter at the terminal to get it to compile.
When I do gem query --loacl I get this:
coderay (1.0.9)
ffi (1.8.1)
formatador (0.2.4)
guard (1.8.0)
guard-sass (1.1.0)
listen (1.0.3)
lumberjack (1.0.3)
method_source (0.8.1)
pry (0.9.12.1)
rb-fsevent (0.9.3)
rb-inotify (0.9.0)
rb-kqueue (0.2.0)
sass (3.2.9, 3.2.8)
slop (3.4.4)
thor (0.18.1)
I should note that this will eventually be a guard init on a Samba share; the directory is not on my physical machine, but I am testing on my local hard drive.
To initialize the guard project, I did guard init and then guard on my 'Portfolio' directory. This my directory structure:
-- Portfolio
-- sass
-- css
-- Guardfile (file)
And this is the contents of my guard file:
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'sass', :input => 'sass', :output => 'css'
I read something about Ruby being compiled against libedit instead of readline. How can I check if this is the issue?
It appears the issue was in fact that Ruby wasn't using readline. I am not a Ruby expert, so I don't know for sure if this was the issue or not. I did follow the directions here and installed the Ruby Version Manager (RVM) and reinstalled Ruby to version 1.9.3 (although I think I could have used the latest 2.0.0) and I reinstalled the guard and guard-sass gems and now my filesystem changes are being detected automatically.
I have a small ruby app that has been working. I am now getting a conflict error with builder. It looks like I updated my gems and now it is conflicting. I have it set in the Gemfile to use v2.1.2. But that is not working either. Thanks for any help you can give me.
Gemfile
gem 'builder', '2.1.2'
Bundler output
$ bundle
Using builder (2.1.2)
Using bundler (1.2.3)
$ bundle show builder
/Users/covard/.rvm/gems/ruby-1.9.3-p327/gems/builder-2.1.2
Conflict message
`raise_if_conflicts': Unable to activate actionpack-3.2.11, because rack-1.5.0 conflicts with rack (~> 1.4.0), builder-3.1.4 conflicts with builder (~> 3.0.0) (Gem::LoadError)
Figured out what my problem was even though I had my Gemfile I wasn't using it. Since rails handles that automatically I didn't know I had to add a require to use it. After adding this to my ruby files it worked perfectly.
require "bundler/setup"
I am using activerecord and feedzirra(RSS parsing library). activerecord needs activesupport v3.2.8 and feedzirra needs v3.1.1. When I use both of them at the same time, I get error that they are conflicting because both of them require different versions of activesupport (3.2.8 vs 3.1.1.
What are my options?
Thanks
Use the latest feedzirra, it doesn't depend on 3.1.1 afaik:
gem 'feedzirra', :git => 'https://github.com/pauldix/feedzirra.git'
I have a ruby script that scans each type of entity in a given tweet:
status = Twitter::Client.new.status(tweet[:id_str], {:include_entities => "1"})
status[:entities].each do |x|
#job on the entity
end
It was doing good until yesterday. Now I get NoMethodError: undefined method 'entities' for #<Twitter::Status:0x000001033e1800>
I can't figure it out since I've checked that status does include entities after the first line.
Any clues?
EDIT: turns out it's the new version of the twitter gem (v2.0.0) which is in cause. First I'd like to downgrade it to the last version working (v1.7.2), but I'm getting an annoying gem version error:
Bundler could not find compatible versions for gem "hashie":
In Gemfile:
topsy (~> 0.3.6) depends on
hashie (~> 1.0.0)
twitter (= 1.7.2) depends on
hashie (1.1.0)
How can I work it out?
If you need specific gem's version, you can forcely set it throught Gemfile:
gem "rack", "1.0.1"
gem "rails", ">=2.3.2"
In the end it was a conflict in the Gemfile:
gem 'topsy', '~> 0.3.6'
gem 'twitter', '1.7.2'
were requesting different versions of hashie, so I just deleted the version of topsy and it worked.
FireWatir
I recently started using Firewatir for testing, I followed all the required steps while installing firewatir but I am not able to run the script.
Here is the information from my local machine
ruby version: ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-mingw32]
gems installed:
C:>gem list
* LOCAL GEMS *
activesupport (3.0.0, 2.3.8)
builder (2.1.2)
commonwatir (1.6.5)
firewatir (1.6.5)
hoe (2.6.2)
json_pure (1.4.6)
rake (0.8.7)
rubyforge (2.0.4)
s4t-utils (1.0.4)
user-choices (1.1.6.1)
xml-simple (1.0.12)
########I used the sample script from the web
#Include the FireWatir file.
require 'firewatir'
ff=FireWatir::Firefox.new
#Open yahoo mail.
ff.goto("http://mail.yahoo.com")
#Put your user name.
ff.text_field(:name,"login").set("User_Name")
#Put your password.
ff.text_field(:name,"passwd").set("Password")
#Click Sign In button.
ff.button(:value,"Sign In").click
#Click Sign Out button.
ff.link(:text, "Sign Out").click
#Close the browser.
ff.close
When I run the above script from the command prompt, instead of opening the firefox browser, it is opening a dialog box to select a program to open this.
I really appreciate that if anyone can help me with this or point me to the right directions.
Thanks
I was able to resolve the issue,not sure exactly how but I followed the following steps:
1. Uninstall and install ruby
2. gem update
3. rolled back activesupport from version 3.0.0 to activesupport 2.3.8.
4. uninstalled JSSH and installed it again and that sure fixed the issue