Skip to content

Instantly share code, notes, and snippets.

@nathanbain
Created June 7, 2012 15:53
Show Gist options
  • Select an option

  • Save nathanbain/2889616 to your computer and use it in GitHub Desktop.

Select an option

Save nathanbain/2889616 to your computer and use it in GitHub Desktop.

Revisions

  1. nathanbain created this gist Jun 7, 2012.
    36 changes: 36 additions & 0 deletions site_prism_example.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    require 'active_support/deprecation'
    require 'active_support/dependencies'
    require 'capybara'
    require 'capybara/dsl'
    require 'selenium-webdriver'
    require 'site_prism'

    class Google < SitePrism::Page
    set_url "http://www.google.com"
    element :search_box, 'input[name=q]'
    end

    class TestIt
    google = Google.new

    Capybara.register_driver :selenium_firefox do |app|
    profile = Selenium::WebDriver::Firefox::Profile.new
    profile["browser.cache.disk.enable"] = false
    profile["browser.cache.memory.enable"] = false
    profile.native_events = false
    Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
    end

    Capybara.configure do |config|
    config.run_server = false
    config.default_selector = :css
    config.default_driver = :selenium_firefox
    config.app_host = 'http://www.google.com'
    end

    Capybara.run_server = false

    google.load
    google.search_box.set "wildfire interactive"

    end