MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / Navigation

Class Navigation

javascript/selenium-webdriver/lib/webdriver.js:1791–1841  ·  view source on GitHub ↗

* Interface for navigating back and forth in the browser history. * * This class should never be instantiated directly. Instead, obtain an instance * with * * webdriver.navigate() * * @see WebDriver#navigate()

Source from the content-addressed store, hash-verified

1789 * @see WebDriver#navigate()
1790 */
1791class Navigation {
1792 /**
1793 * @param {!WebDriver} driver The parent driver.
1794 * @private
1795 */
1796 constructor(driver) {
1797 /** @private {!WebDriver} */
1798 this.driver_ = driver
1799 }
1800
1801 /**
1802 * Navigates to a new URL.
1803 *
1804 * @param {string} url The URL to navigate to.
1805 * @return {!Promise<void>} A promise that will be resolved when the URL
1806 * has been loaded.
1807 */
1808 to(url) {
1809 return this.driver_.execute(new command.Command(command.Name.GET).setParameter('url', url))
1810 }
1811
1812 /**
1813 * Moves backwards in the browser history.
1814 *
1815 * @return {!Promise<void>} A promise that will be resolved when the
1816 * navigation event has completed.
1817 */
1818 back() {
1819 return this.driver_.execute(new command.Command(command.Name.GO_BACK))
1820 }
1821
1822 /**
1823 * Moves forwards in the browser history.
1824 *
1825 * @return {!Promise<void>} A promise that will be resolved when the
1826 * navigation event has completed.
1827 */
1828 forward() {
1829 return this.driver_.execute(new command.Command(command.Name.GO_FORWARD))
1830 }
1831
1832 /**
1833 * Refreshes the current page.
1834 *
1835 * @return {!Promise<void>} A promise that will be resolved when the
1836 * navigation event has completed.
1837 */
1838 refresh() {
1839 return this.driver_.execute(new command.Command(command.Name.REFRESH))
1840 }
1841}
1842
1843/**
1844 * Provides methods for managing browser and driver state.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected