Sha256: 72bd49303c2d8faea7d2050f4a8a58408ecd0d5b6eaa450d39e12081235390cb

Contents?: true

Size: 926 Bytes

Versions: 4

Compression:

Stored size: 926 Bytes

Contents

require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))

describe Watir::Element do

  describe "#send_keys" do
    it "sends keystrokes to the element" do
      browser.goto("file://" + File.expand_path("html/keylogger.html", File.dirname(__FILE__)))
      browser.div(:id, 'receiver').send_keys("hello world")
      browser.div(:id, 'output').ps.size.should == 11
    end
  end

  describe "#present?" do
    before do
      browser.goto("file://" + File.expand_path("html/wait.html", File.dirname(__FILE__)))
    end

    it "returns true if the element exists and is visible" do
      browser.div(:id, 'foo').should be_present
    end

    it "returns false if the element exists but is not visible" do
      browser.div(:id, 'bar').should_not be_present
    end

    it "returns false if the element does not exist" do
      browser.div(:id, 'should-not-exist').should_not be_present
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-webdriver-0.2.0 spec/element_spec.rb
watir-webdriver-0.2.0.dev2 spec/element_spec.rb
watir-webdriver-0.2.0.dev spec/element_spec.rb
watir-webdriver-0.1.9 spec/element_spec.rb