notSee

Returns true if it does not find the object specified by the locator. If it does, it throws an error.

Usage in test

To use it in the test, the notSee.<child_method>('<locator>',propeties<object>) method is used.

default child_method: xpath

Child Methods:
className         : Locates elements whose class name contains the search value (compound class names are not permitted)
css               : Locates elements matching a CSS selector
id                : Locates elements whose ID attribute matches the search value
name              : Locates elements whose NAME attribute matches the search value
text              : Locates anchor elements whose visible text matches the search value
partialText       : Locates anchor elements whose visible text contains the search value. If multiple elements are matching, only the first one will be selected.
linkText          : If the element we want to locate is a link, we can use the link text locator to identify it on the web page. Locates anchor elements whose visible text matches the search value
partialLinkText   : If the element we want to locate is a link, we can use the link text locator to identify it on the web page. Locates anchor elements whose visible text contains the search value. If multiple elements are matching, only the first one will be selected.
tagName           : Locates elements whose tag name matches the search value
xpath             : Locates elements matching an XPath expression
Properties:
timeout: <seconds> // defaults: 5 seconds
tests/sample1.js
/* LIBRARIES
*************/
const { sente } = require('#libraries');
const { notSee } = sente;


/* TEST FLOW
*************/
test = async () => {
   
   // Search with xpath
   await notSee('//div[@id="username"]'); 
   
   // Search with xpath
   await notSee.xpath('//*[text()="SENTE IO"]'); 
   
   // Search with id
   await notSee.id('username'); 
   
   // With timeout Properties
   await notSee.id('username', {timeout: 10}); 

        
}

Last updated