To emulate mouse hover with Capybara use the following method:
find(:css, "#menu_bar").hover
I am using capybara (2.1.0) and selenium-webdriver (2.32.1)
Tuesday, May 7, 2013
Wednesday, September 5, 2012
Frame in Capybara
To access the element in a frame or iframe using capybara use the following within method
within_frame('iframex') do
fill_in "email", :with => random_email
end
within_frame('iframex') do
fill_in "email", :with => random_email
end
Wednesday, August 22, 2012
Ignore browser untrusted security certificate
To ignore the browser untrusted security certificate so that the cucumber test can be run in the test environment you can modify the env.rb to ignore the warning:
require 'selenium/webdriver' Capybara.register_driver :selenium do |app| profile = Selenium::WebDriver::Firefox::Profile.new profile.assume_untrusted_certificate_issuer = false Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile) end
Tuesday, August 14, 2012
file upload using capybara
To put the file name into the file upload dialog box with Capybara we can use the following Selenium webdriver method. We can use the Ruby code Dir.pwd to get the current working directory path.
page.driver.browser.find_element(:id, "fileUploadId").send_keys (Dir.pwd + "file upload path")
Subscribe to:
Posts (Atom)