Skip to main content

Load pages in the app’s window, go back and forward, and read the page. Paths follow http://127.0.0.1:4445/{token}; see the overview for the reply format and the errors.

A navigation waits for the new page: the page script answers that it is leaving until the old page is gone, so the old page’s complete is never taken for the new one, and the command answers once the new document’s readyState is complete, or 500 timeout when the session’s pageLoad timeout (60 seconds by default) is over. Every navigation leaves any frame entered for the top page. The dialogs recorded, the dialog answer set and the element ids are forgotten when the window loads another document.

POST /session/{sessionId}/url

Sets the top page’s location.href. A URL that differs from the current one only in its hash does not unload the page; the command then answers as soon as the page is complete.

Path

sessionIdstringrequired#

The current session’s id.

Body

urlstringrequired#

The URL to load, absolute or relative to the current page.

Response

valuenullrequired#

null, once the page has loaded.

Errors

StatuserrorWhen
400invalid argumenturl is missing or not a string (`url` is missing).
500timeoutThe page did not load within pageLoad.

Get current URL#

GET /session/{sessionId}/url

The top page’s location.href, also while a frame is entered.

Path

sessionIdstringrequired#

The current session’s id.

Response

valuestringrequired#

The URL.

Get title#

GET /session/{sessionId}/title

Verified on macOS

The top page’s document.title, also while a frame is entered.

Path

sessionIdstringrequired#

The current session’s id.

Response

valuestringrequired#

The title.

Back, forward and refresh#

POST /session/{sessionId}/back

POST /session/{sessionId}/forward

POST /session/{sessionId}/refresh

Call history.back(), history.forward() or location.reload() in the top page, then wait for the page like Navigate to. A history entry of the same document (a hash change, pushState) fires hashchange or popstate, and the command answers once the page is complete.

Warning

With no entry to go back or forward to, the page does not unload, so the command answers 500 timeout only when the pageLoad timeout is over.

Path

sessionIdstringrequired#

The current session’s id.

Response

valuenullrequired#

null, once the page has loaded.

Errors

StatuserrorWhen
500timeoutThe page did not load within pageLoad.

Get page source#

GET /session/{sessionId}/source

The outerHTML of the current frame’s document element: of the frame entered, or of the top page.

Path

sessionIdstringrequired#

The current session’s id.

Response

valuestringrequired#

The HTML, from <html> to </html>, without a doctype.

Errors

StatuserrorWhen
404no such frameThe frame entered is gone or no longer same-origin.