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.
Navigate to#
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
The current session’s id.
Body
The URL to load, absolute or relative to the current page.
Response
null, once the page has loaded.
Errors
| Status | error | When |
|---|---|---|
| 400 | invalid argument | url is missing or not a string (`url` is missing). |
| 500 | timeout | The 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
The current session’s id.
Response
The URL.
Get title#
GET /session/{sessionId}/title
The top page’s document.title, also while a frame is entered.
Path
The current session’s id.
Response
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.
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
The current session’s id.
Response
null, once the page has loaded.
Errors
| Status | error | When |
|---|---|---|
| 500 | timeout | The 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
The current session’s id.
Response
The HTML, from <html> to </html>, without a doctype.
Errors
| Status | error | When |
|---|---|---|
| 404 | no such frame | The frame entered is gone or no longer same-origin. |