. |-- Gemfile `-- spec `-- sample_spec.rb
source 'https://rubygems.org' gem 'selenium-webdriver' gem 'selenium-client' gem 'rspec'
# encoding: utf-8 require "json" require "selenium-webdriver" require "rspec" include RSpec::Expectations describe "SeleniumRCTest" do before(:each) do # Local @driver = Selenium::WebDriver.for(:remote, :url => 'http://localhost:4444/wd/hub', :desired_capabilities => :firefox) #@driver = Selenium::WebDriver.for(:remote, :url => 'http://localhost:4444/wd/hub', :desired_capabilities => :chrome) #@driver = Selenium::WebDriver.for(:remote, :url => 'http://localhost:4444/wd/hub', :desired_capabilities => :ie) @base_url = "http://www.google.com/" @accept_next_alert = true @driver.manage.timeouts.implicit_wait = 30 @verification_errors = [] end after(:each) do @driver.quit @verification_errors.should == [] end it "test_sample" do # Search Amazon @driver.get "http://www.google.com" @driver.get(@base_url + "/?gfe_rd=ctrl&ei=6IUzU63nMoHN8ge88IHYBw&gws_rd=cr") @driver.find_element(:id, "gbqfq").clear @driver.find_element(:id, "gbqfq").send_keys "amazon" @driver.find_element(:css, "td > span").click end def element_present?(how, what) @driver.find_element(how, what) true rescue Selenium::WebDriver::Error::NoSuchElementError false end def alert_present?() @driver.switch_to.alert true rescue Selenium::WebDriver::Error::NoAlertPresentError false end def verify(&blk) yield rescue ExpectationNotMetError => ex @verification_errors << ex end def close_alert_and_get_its_text(how, what) alert = @driver.switch_to().alert() alert_text = alert.text if (@accept_next_alert) then alert.accept() else alert.dismiss() end alert_text ensure @accept_next_alert = true end end
java -jar selenium-server-standalone-2.44.0.jar
bundle exec rspec spec/
Streamlit is a …
I bought M5Stac…