Files
cypress/docs/source/api/commands/not.md
T
2017-05-23 17:17:27 -04:00

1.6 KiB

title, comments, description
title comments description
not true

Remove DOM elements from the set of DOM elements. Opposite of cy.filter()

Returns the new DOM element(s) found by the command.
Timeout cy.not will retry for the duration of the defaultCommandTimeout

cy.not( selector )

Remove the element(s) by it's selector from the elements

Options

Pass in an options object to change the default behavior of cy.not.

cy.not( selector, options )

Option Default Notes
log true whether to display command in command log
timeout defaultCommandTimeout Total time to retry getting the element

Selector Usage

Filter the current subject to the elements that do not have class active.

cy.get('.left-nav>.nav').find('>li').not('.active')

Command Log

Find all buttons that are not of type submit

cy.get('form').find('button').not('[type="submit"]')

The commands above will display in the command log as:

screen shot 2015-11-29 at 12 36 49 pm

When clicking on not within the command log, the console outputs the following:

screen shot 2015-11-29 at 12 37 39 pm

See also