mirror of
https://github.com/jbranchaud/til
synced 2026-03-04 06:58:45 +00:00
Add Navigate Back In The Browser With Capybara as a ruby til
This commit is contained in:
15
ruby/navigate-back-in-the-browser-with-capybara.md
Normal file
15
ruby/navigate-back-in-the-browser-with-capybara.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Navigate Back In The Browser With Capybara
|
||||
|
||||
There are two ways to navigate back to a previous page. Capybara is driving
|
||||
the browser and it can be instructed to go back using its built-in command
|
||||
or by executing some JavaScript.
|
||||
|
||||
```ruby
|
||||
page.go_back
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```ruby
|
||||
page.evaluate_script('window.history.back()')
|
||||
```
|
||||
Reference in New Issue
Block a user