Sha256: c8c0497eae9a9354212966259fc1f210f7fbb3f75d25b61e92b97e67e4c8afd4

Contents?: true

Size: 808 Bytes

Versions: 12

Compression:

Stored size: 808 Bytes

Contents

# encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

describe "Links" do

  before :each do
    browser.goto(WatirSpec.files + "/non_control_elements.html")
  end

  describe "#length" do
    it "returns the number of links" do
      browser.links.length.should == 4
    end
  end

  describe "#[]" do
    it "returns the link at the given index" do
      browser.links[2].id.should == "link_3"
    end

    it "returns a Link object also when the index is out of bounds" do
      browser.links[2000].should_not be_nil
    end
  end

  describe "#each" do
    it "iterates through links correctly" do
      browser.links.each_with_index do |c, index|
        c.id.should == browser.link(:index, index).id
        c.value.should == browser.link(:index, index).value
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
watir-webdriver-0.0.6 spec/watirspec/links_spec.rb
watir-webdriver-0.0.5 spec/watirspec/links_spec.rb
watir-webdriver-0.0.4 spec/watirspec/links_spec.rb
watir-webdriver-0.0.3 spec/watirspec/links_spec.rb
watir-webdriver-0.0.2 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1.dev7 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1.dev5 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1.dev4 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1.dev3 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1.dev2 spec/watirspec/links_spec.rb
watir-webdriver-0.0.1.dev spec/watirspec/links_spec.rb