Sha256: b6456ea7c24a870001ea82de6040ede4f58d3e15ccaf0cbcd133be8f5dfcea40

Contents?: true

Size: 1.8 KB

Versions: 4

Compression:

Stored size: 1.8 KB

Contents

require File.expand_path(__FILE__ + '/../../spec_helper')

describe "#wait_for_element" do
  it "does not block when element is present" do
    page.open "http://localhost:4567/jquery.html"
    page.wait_for_element "element-present-demo"
    page.wait_for_element "id=element-present-demo"
    page.wait_for_element "css=#element-present-demo"
  end

  it "times out when element is not present" do
    page.open "http://localhost:4567/jquery.html"

    should_timeout do
      page.wait_for_element "new-element", :timeout_in_seconds => 2
    end

    should_timeout do
      page.wait_for_element "does-not-exists", :timeout_in_seconds => 2
    end
  end

  it "detects dynamics changes in the DOM" do
    page.open "http://localhost:4567/jquery.html"
    page.click "create-element-button", :wait_for => :element, :element => 'new-element'
    page.click "delete-element-button", :wait_for => :no_element, :element => 'new-element'

    should_timeout do
      page.wait_for_element "new-element", :timeout_in_seconds => 2
    end
  end

  it "can handle quotes and double quotes in its locator definition" do
    page.open "http://localhost:4567/jquery.html"
    page.wait_for_element "//div[@id='element-present-demo']"
    page.wait_for_no_element "//div[@id='new-element']"
    page.click "create-element-button", :wait_for => :element, :element => "//div[@id='new-element']"
  end
end

describe "#wait_for_no_element" do
  it "does not block when element is not present" do
    page.open "http://localhost:4567/jquery.html"
    page.wait_for_no_element "new-element"
    page.wait_for_no_element "does-not-exists"
  end

  it "times out when element is present" do
    page.open "http://localhost:4567/jquery.html"

    should_timeout do
      page.wait_for_no_element "element-present-demo", :timeout_in_seconds => 2
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
browserstack-webdriver-2.40.1 spec/integration/selenium/client/api/wait_for_element_spec.rb
browserstack-webdriver-0.0.22 spec/integration/selenium/client/api/wait_for_element_spec.rb
browserstack-webdriver-0.0.1 spec/integration/selenium/client/api/wait_for_element_spec.rb
bbc-selenium-webdriver-1.17.0 spec/integration/selenium/client/api/wait_for_element_spec.rb