* 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()
| 1915 | * @see WebDriver#navigate() |
| 1916 | */ |
| 1917 | class Navigation { |
| 1918 | /** |
| 1919 | * @param {!WebDriver} driver The parent driver. |
| 1920 | * @private |
| 1921 | */ |
| 1922 | constructor(driver) { |
| 1923 | /** @private {!WebDriver} */ |
| 1924 | this.driver_ = driver |
| 1925 | } |
| 1926 | |
| 1927 | /** |
| 1928 | * Navigates to a new URL. |
| 1929 | * |
| 1930 | * @param {string} url The URL to navigate to. |
| 1931 | * @return {!Promise<void>} A promise that will be resolved when the URL |
| 1932 | * has been loaded. |
| 1933 | */ |
| 1934 | to(url) { |
| 1935 | return this.driver_.execute(new command.Command(command.Name.GET).setParameter('url', url)) |
| 1936 | } |
| 1937 | |
| 1938 | /** |
| 1939 | * Moves backwards in the browser history. |
| 1940 | * |
| 1941 | * @return {!Promise<void>} A promise that will be resolved when the |
| 1942 | * navigation event has completed. |
| 1943 | */ |
| 1944 | back() { |
| 1945 | return this.driver_.execute(new command.Command(command.Name.GO_BACK)) |
| 1946 | } |
| 1947 | |
| 1948 | /** |
| 1949 | * Moves forwards in the browser history. |
| 1950 | * |
| 1951 | * @return {!Promise<void>} A promise that will be resolved when the |
| 1952 | * navigation event has completed. |
| 1953 | */ |
| 1954 | forward() { |
| 1955 | return this.driver_.execute(new command.Command(command.Name.GO_FORWARD)) |
| 1956 | } |
| 1957 | |
| 1958 | /** |
| 1959 | * Refreshes the current page. |
| 1960 | * |
| 1961 | * @return {!Promise<void>} A promise that will be resolved when the |
| 1962 | * navigation event has completed. |
| 1963 | */ |
| 1964 | refresh() { |
| 1965 | return this.driver_.execute(new command.Command(command.Name.REFRESH)) |
| 1966 | } |
| 1967 | } |
| 1968 | |
| 1969 | /** |
| 1970 | * Provides methods for managing browser and driver state. |
nothing calls this directly
no outgoing calls
no test coverage detected