lunes, 10 de agosto de 2015

Finding an element on the page by their XPath


There are many ways to find element on pages, for example we can find an element by id,name,class,etc.  in previous post I explains a little bit of others ways to find elements. Review this http://marisolchambiarrosquipa.blogspot.com/2015/05/design-patterns.html

using name or id is for simple test, but for more complex situations, we need to know xpath
Xpath is one of the most useful approaches to find elements on the page.
It is most commonly used web testing framework.It allows us to write tests.

Tools that can useful to find elements on the page.

we can use many tools for the browser firefox
*Selenium IDE (In previous post I explains how to use it. Review this  http://marisolchambiarrosquipa.blogspot.com/2014/06/selenium.html)



*FireXpath and Firebug







*The pages have an  ViewXpath option




A single slash(/) at the start of xpath instructs Xpath engine to look for element starting from root node
A double slash (//)at the start of path instructs xpath engine to search look for matching element in the anywhere in the page.

//->XPath begins from the current location.
For example if we put "//input" find all elements that have this tags.
following-sibling:selects all siblings after the current tag
following :contains all nodes with occur after the tag, in document order
parent: contains the parent of the tag if it have one

Find elements using FireXpath tools















No hay comentarios:

Publicar un comentario