cy.get()

 What is the purpose of cy.get() command?

  • It is used to get one or more DOM elements in selector or alias
  • It is safe to chain further commands
  • It automatically retries until DOM exists
  • It will automatically retry until chained assertions are passed
  • It can timeout waiting for elements
  • it can timeout waiting for assertions

What arguments can be passed with cy.get()?

  • cy.get(selector)
  • cy.get(alias)
  • cy.get(selector, options)
  • cy.get(alias, options)

Explain the Selector argument

  • It should be a string
  • Used to filter matching dom elements

Explain the Alias argument

  • It should be a string
  • We use "@" symbol along with the alias

Explain the Options argument

  • It is an Object
  • It is used to change the default behaviour of cy.get() command

What are the options that can be used as arguments?

  • log
  • defaultTimeOut
  • includeShadowDom
  • withinSubject

What is the purpose of a log argument?

Displays the command in the command.log

What is the purpose of a timeout argument?

Time to wait for cy.get() to get resolved before the timeout

What is the purpose of the includeShadowDom argument?

Whether to traverse shadow dom boundaries and include elements within the shadow in the provided results

Provide Sample usage of cy.get()

cy.get('.class name').click()
cy.get('@todo').type('username')










    No comments:

    Post a Comment