# Accessor Functions

<meta charset="UTF-8" id="bkmrk-"></meta><title id="bkmrk-accessor-functions--">Accessor Functions - Appvance Test Designer JS Commands</title><style id="bkmrk-body-%7B-font-family%3A-">
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; line-height: 1.6; }
h1 { color: #1a73e8; border-bottom: 2px solid #1a73e8; padding-bottom: 8px; }
h3 { color: #333; margin-top: 24px; }
code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
pre { background: #f5f5f5; padding: 12px; border-radius: 4px; overflow-x: auto; }
blockquote { background: #f9f9f9; border-left: 4px solid #1a73e8; margin: 12px 0; padding: 8px 16px; }
p.note { background: #fff3cd; border-left: 4px solid #ffc107; padding: 8px 16px; }
</style></head><body>Assert functions will **always** trigger a failure if they do not succeed. Verify Functions described above, unlike Assert functions, can be configure not to fail the script execution using the setAssertType function.

### <span>\_byClassName = byClassName</span> 

Parameters: value  
Description: <span style="color: rgb(0,0,0);">Finds an element by class name with given tag name and constrained by given relations</span>  
Example:

> `<div class="bigfont">Some text</div>`
> 
> `_byClassName("bigfont", "DIV")`

### \_byCss = byCss

Parameters: value  
Description: This returns the element matching with the specified css  
Example:

> `_navigateTo("`http://sahitest.com/`");`  
> `_click(_link("demo"));`  
> `_click(_byCss(<span>"a.a.x"</span>));`  
> `_click(_link("Back"));`

### \_byId = byId

Parameters: value  
Description: This returns the element matching with the specified id  
Example 1:

> `<div id="s2id_autogen2">Add Member</div>`

> `_byId("s2id_autogen2") // points to the above tag. Note that the tagName "div" is not used here.`

Example 2:

> `_navigateTo("`http://sahitest.com/`demo/linkTest.htm");`  
> `_click(_byCss("myLink"));`

> 

### \_byName = byName

Parameters: value  
Description: Finds the element with the name of the element. If more than one match, this returns the first matching element.  
Example:

> `navigateTo("`http://sahitest.com/`");`  
> `click(link("demo"));`  
> `click(link("Form Test"));`  
> `var t1 = byName("t1");`

### \_byJQuery = byJQuery

Parameters: value  
Description: Returns the first match based on the input string. Input can be any of jQuery selectors  
Example:

> `byJQuery("#s1Id");  // id selector since u can see # in it`   
> `byJQuery("input"); // returns the first match input element`   
> `byJQuery(".ac-content");  // returns the first match of element class selector`

### \_bySelenium = bySelenium

Parameters: value  
Description: uses selenium locator to get the element  
Example:

> `_navigateTo("`http://sahitest.com/demo/`");`  
> `_click(_bySelenium("css=a.a.x"));`  
> `_click(_link("Back"));`

### \_byTagName = byTagName

Parameters: value  
Description: Finds the element with the tag name of the element. If more than one match, this returns the first matching element.  
Example:

> `navigateTo("`http://sahitest.com/`");`  
> `click(link("demo"));`  
> `click(link("Form Test"));`  
> `var text = byTagName("input");`

### \_byXPath = byXPath

Parameters: value  
Description: This returns the element matching with the specified XPath  
Example:

> `navigateTo("`http://demosite.appvance.com/`");`  
> `click(byXPath('//*[@class="list-group-item"]'));`  
> `click(byXPath('//*[@class="list-group-item"]'));`