Sha256: aec4e3131c31a424dddd0bbb8d84135f8dc511e4d8a3266c4e15425950260545

Contents?: true

Size: 934 Bytes

Versions: 5

Compression:

Stored size: 934 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.element(:id, 'receiver').send_keys("hello world")
      browser.element(: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

5 entries across 5 versions & 1 rubygems

Version Path
watir-webdriver-0.2.5 spec/element_spec.rb
watir-webdriver-0.2.4 spec/element_spec.rb
watir-webdriver-0.2.3 spec/element_spec.rb
watir-webdriver-0.2.2 spec/element_spec.rb
watir-webdriver-0.2.1 spec/element_spec.rb