Module: Watir::Navigation

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

Instance Method Summary collapse

Instance Method Details

#backObject

Navigates back in history.



28
29
30
31
# File 'lib/watir/navigation.rb', line 28

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

#forwardObject

Navigates forward in history.



37
38
39
40
# File 'lib/watir/navigation.rb', line 37

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.



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

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

  @driver.navigate.to uri
  @after_hooks.run

  uri
end

#refreshObject

Refreshes current page.



46
47
48
49
# File 'lib/watir/navigation.rb', line 46

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