How to Automate Basic Browser Navigation#
Standard Buttons#
Similar to Selenium, use these simple commands to automate the browser:
Action | Code | Description |
---|---|---|
Forward | browser.forward() | Press the browser's back button |
Back | browser.back() | Press the browser's forward button |
Refresh | browser.refresh() | Reload the current page |
Quit | browser.quit() | Close the browser |
Examples#
Python | |
---|---|
Tip
Instead of manually quitting the browser with browser.quit()
, it's recommend to use the context manager and with
statements. The example above could then be refactored to: