Relational Accessor Functions

The relational accessor functions specifiy that elements should be searched for in relation to a specified element.

IN

in is a DOM relation API that mentions that the element should be searched within another element.

Example:

API_Relational_in.png

near

The near API is a DOM relational marker that specifies that the element should be searched near another element.

The near accessor works best when you are looking for an element within the proximity of the selected reference point.

The near accessor identifies the center point of the nearby elements and calculates the distance between the center point of the reference point and the nearby objects in all directions.

Example

Relative_Near_01.png

On this example page, the reference point is the highlighted link “Label page“.

API_Relational_near.png

JavaScript Example

navigateTo("https://www.apple.com/");       
_click(_link("ac-gn-link ac-gn-link-mac"));        
_click(_link("ac-gn-link ac-gn-link-iphone",_near(_link("/ipad/"))));       
_click(_link("/ipad/"));       
_click(_span("chapternav-label[1]",_near(_link("/ipad/"))));

above / below 

Just like in and near - above, below, rightOf, and leftOf can be used as relational accessors to give you more options to make the accessor or the step more robust.

This mostly would be useful in working with tables.

Syntax

Syntax is same as in and near relational API's.

_rightOfcell("Tote",_rightOf(strong("Type")))        _leftOfstrong("Type",_leftOf(cell("Tote")))        _abovestrong("Type",_above(strong("Size")))        _belowstrong("Size",_below(strong("Type")))

API_Relational_above_below_rightOf_leftOf.png

Exported JavaScript

navigateTo("https://demosite.appvance.com/");        click(span("Ruby on Rails Tote"));        setDescription("Using in Relational Accessor");        click(span("Products",_in(link("/products"))));        click(span("Ruby on Rails Tote"));        setDescription("Using rightOf Relational Accessor");        assertExists(cell("Tote",_rightOf(strong("Type"))));        setDescription("Using leftOf Relational Accessor");        assertExists(strong("Type",_leftOf(cell("Tote"))));        setDescription("Using above Relational Accessor");        assertExists(strong("Type",_above(strong("Size"))));        setDescription("Using below Relational Accessor");        assertExists(strong("Type",_leftOf(ds.cell("Tote"))));

rightOf / leftOf

Just like in and near - above, below, rightOf, and leftOf can be used as relational accessors to give you more options to make the accessor or the step more robust.

This mostly would be useful in working with tables.

Syntax

Syntax is same as in and near relational API's.

_rightOfcell("Tote",_rightOf(strong("Type")))   
_leftOfstrong("Type",_leftOf(cell("Tote")))      
 _abovestrong("Type",_above(strong("Size"))) 
  _belowstrong("Size",_below(strong("Type")))

API_Relational_above_below_rightOf_leftOf.png

Exported JavaScript

navigateTo("https://demosite.appvance.com/");        
click(span("Ruby on Rails Tote"));       
setDescription("Using in Relational Accessor");     
click(span("Products",_in(link("/products"))));     
click(span("Ruby on Rails Tote"));      
setDescription("Using rightOf Relational Accessor");      
assertExists(cell("Tote",_rightOf(strong("Type"))));      
setDescription("Using leftOf Relational Accessor");       
assertExists(strong("Type",_leftOf(cell("Tote"))));       
setDescription("Using above Relational Accessor");       
assertExists(strong("Type",_above(strong("Size"))));      
setDescription("Using below Relational Accessor");      
assertExists(strong("Type",_leftOf(ds.cell("Tote"))));

If you have any feedback on this topic, please contact us at documentation@appvance.ai


Revision #2
Created 2026-07-24 14:33:03 UTC by Admin
Updated 2026-08-03 13:29:41 UTC by mmora