Module: Watir::Navigation

Included in:
Browser
Defined in:
lib/watir/navigation.rb

Instance Method Summary collapse

Instance Method Details

#backObject

Navigates back in history.


26
27
28
29
# File 'lib/watir/navigation.rb', line 26

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

#forwardObject

Navigates forward in history.


35
36
37
38
# File 'lib/watir/navigation.rb', line 35

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

#goto(uri) ⇒ String

Goes to the given URL.

Examples:

browser.goto "watir.github.io"

Parameters:

  • uri (String)

    The url.

Returns:

  • (String)

    The url you end up at.


13
14
15
16
17
18
19
20
# File 'lib/watir/navigation.rb', line 13

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

  @driver.navigate.to uri
  @after_hooks.run

  uri
end

#refreshObject

Refreshes current page.


44
45
46
47
# File 'lib/watir/navigation.rb', line 44

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