Sha256: ea15d08cafbe167086ef50c111227f648a01a143cd9ccdcc4736301db9662d43

Contents?: true

Size: 824 Bytes

Versions: 4

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true

module Watir
  module Navigation
    #
    # Goes to the given URL.
    #
    # @example
    #   browser.goto "watir.github.io"
    #
    # @param [String] uri The url.
    # @return [String] The url you end up at.
    #

    def goto(uri)
      uri = "http://#{uri}" unless uri&.match?(URI::DEFAULT_PARSER.make_regexp)

      @driver.navigate.to uri
      @after_hooks.run

      uri
    end

    #
    # Navigates back in history.
    #

    def back
      @driver.navigate.back
      @after_hooks.run
    end

    #
    # Navigates forward in history.
    #

    def forward
      @driver.navigate.forward
      @after_hooks.run
    end

    #
    # Refreshes current page.
    #

    def refresh
      @driver.navigate.refresh
      @after_hooks.run
    end
  end # Navigation
end # Watir

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-7.3.0 lib/watir/navigation.rb
watir-7.2.2 lib/watir/navigation.rb
watir-7.2.1 lib/watir/navigation.rb
watir-7.2.0 lib/watir/navigation.rb