Sha256: a0596b753819bd2b1cb69e83a342f6b69c69d2a445dcfaad26598344017fe042

Contents?: true

Size: 906 Bytes

Versions: 23

Compression:

Stored size: 906 Bytes

Contents

require "watirspec_helper"

describe "Divs" do

  before :each do
    browser.goto(WatirSpec.url_for("non_control_elements.html"))
  end

  describe "with selectors" do
    it "returns the matching elements" do
      expect(browser.divs(id: "header").to_a).to eq [browser.div(id: "header")]
    end
  end

  describe "#length" do
    it "returns the number of divs" do
      expect(browser.divs.length).to eq 12
    end
  end

  describe "#[]" do
    it "returns the div at the given index" do
      expect(browser.divs[1].id).to eq "outer_container"
    end
  end

  describe "#each" do
    it "iterates through divs correctly" do
      count = 0

      browser.divs.each_with_index do |d, index|
        expect(d.id).to eq browser.div(index: index).id
        expect(d.class_name).to eq browser.div(index: index).class_name

        count += 1
      end

      expect(count).to be > 0
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
watir-6.7.3 spec/watirspec/elements/divs_spec.rb
watir-6.7.2 spec/watirspec/elements/divs_spec.rb
watir-6.7.1 spec/watirspec/elements/divs_spec.rb
watir-6.7.0 spec/watirspec/elements/divs_spec.rb
watir-6.6.3 spec/watirspec/elements/divs_spec.rb
watir-6.6.2 spec/watirspec/elements/divs_spec.rb
watir-6.6.1 spec/watirspec/elements/divs_spec.rb
watir-6.6.0 spec/watirspec/elements/divs_spec.rb
watir-6.5.0 spec/watirspec/elements/divs_spec.rb
watir-6.4.3 spec/watirspec/elements/divs_spec.rb
watir-6.4.2 spec/watirspec/elements/divs_spec.rb
watir-6.4.1 spec/watirspec/elements/divs_spec.rb
watir-6.4.0 spec/watirspec/elements/divs_spec.rb
watir-6.4.0.rc2 spec/watirspec/elements/divs_spec.rb
watir-6.4.0.rc1 spec/watirspec/elements/divs_spec.rb
watir-6.3.0 spec/watirspec/elements/divs_spec.rb
watir-6.2.1 spec/watirspec/elements/divs_spec.rb
watir-6.2.0 spec/watirspec/elements/divs_spec.rb
watir-6.1.0 spec/watirspec/elements/divs_spec.rb
watir-6.0.3 spec/watirspec/elements/divs_spec.rb