Question about XPath related to DOM element

Applying eValid to AJAX applications that require advanced DOM-based methods.

Question about XPath related to DOM element

Postby JerMaren » Wed Apr 27, 2016 3:16 pm

Afternoon.

Hey guys, does eValid's command capability provide for either use of an explicitly XPath or the use of regular expressions in finding a DOM element?

Thanks a bunch.
JerMaren
 
Posts: 1
Joined: Wed Apr 27, 2016 3:13 pm

Re: Question about XPath related to DOM element

Postby eValid » Thu Apr 28, 2016 8:34 am

JerMaren wrote:Afternoon.

Hey guys, does eValid's command capability provide for either use of an explicitly XPath or the use of regular expressions in finding a DOM element?

Thanks a bunch.


Thanks for asking JerMaren.

XPath is a way of identifying a path in the DOM hierarchy, and it has some string processing functions that work very similarly to how a Regular Expression (RE) works.

An XPath expression is effectively an address into the DOM, but it can be quite general, implying a search sequence that finds something based on a string match.

An RE is specifically a search pattern for use in scanning a document that describes matches that occur in the document.

You can't quite put a RE in an XPath, but you can get pretty close to it using the string processing methods that are built in to the XPath capability.

The most common way an XPath is used in web application testing is to specify the path to a DOM element that has a string match within the string of some DOM node that has a bunch of properties defined on it.

You write the XPath and include it in your JavaScript and the browser takes care of filling in the blanks.

You can find a particular element knowing only a few details of its expected content.

The DOM API that's used is the "GetElementBy..." method group.

These to Wikipedia articles are actually quite good:

https://en.wikipedia.org/wiki/XPath

https://en.wikipedia.org/wiki/Regular_expression

What eValid does is combine these two ideas in the IndexFindElementEx command, described here:

http://www.e-valid.com/Products/Documen ... nt.ex.html

This command accepts an RE (which also could be a simple string) as an argument and uses matches made at the RE level to identify the first matching DOM element, the value of which it stores into the current sourceIndex value.

-- eValid Support
eValid
 
Posts: 1751
Joined: Tue Jan 01, 2008 12:48 pm
Location: USA


Return to AJAX Applications & DOM Processing

Design Downloaded from free phpBB templates | free website templates | Free Web Buttons