visit
effect:
Access a remote URL.
(Suggestion: use before setting baseUrl)
grammar:
cy.visit(url)
cy.visit(url, options)
cy.visit(options)
use:
cy.visit ( 'HTTP: // localhost: 3000') // generate remote page window
parameter:
> url (String)
To access the URL. ( If you set
baseUrl
will be usedbaseUrl
to configure the url as a prefix )> options (Object)
Pass a object to control options for this method.
Options:
Options |
default |
description |
|
|
To access the URL, the |
|
|
For use in accessing the HTTP method, it may be |
|
|
And If it is a string, to pass intact. If it is an object to be encoded with a string |
|
|
HTTP header name mapping object value to be transmitted along with the request. Note: |
|
|
Displays the command in the command log |
|
|
Add basic authorization header |
|
|
When the response code is not |
|
|
Called before the page loads all the resources |
|
|
After your page load event triggers its call |
|
|
When the status code if the error is automatically retry |
|
|
When the network errors are automatically retried |
|
|
Page load timeout in milliseconds. |
example:
// set the timeout cy.visit ( '/ index.html', {timeout: 30000 }) // add authentication (. 1) cy.visit ( 'https://www.acme.com/' , { the auth: { username: 'Wile' , password: 'Coyote' } }) // add authentication (2) cy.visit ( 'HTTPS: // Wile: [email protected]' ) // page finished loading after all resources call the function cy.visit ( 'HTTP: // localhost: 3000 / # Dashboard' , { : (contentWindow) onBeforeLoad => { // contentWindow window object is remote pages } }) // call the function after the trigger event is loaded cy. visit ( 'http: // localhost: 3000 / # / users', { The onLoad: (contentWindow) => { // contentWindow window object is remote page IF (contentWindow.angular) { // events } } }) // send a post request cy.visit ({ URL: 'HTTP: / / localhost: 3000 / CGI-bin / newsletterSignup ' , Method: ' the POST ' , body: { name: ' George P. Burdell ' , In Email: ' [email protected] ' } })