Blog

Latest Updates. News. Insights. Ideas.

January 2010 - Sahi Pro

Web automation does not need XPaths

Posted by | Uncategorized | 3 Comments

Really.

Learn this web automation nursery rhyme today!

XPaths are evil,
XPaths are fickle,
Developers touch code,
And the testers are in a pickle!

Have you ever used XPaths and found that it needs non-trivial amount of effort in maintenance?

Especially testers, who do not have the time or energy to get XPaths right, stay away from XPaths. Use ids or names or any other attribute the web element provides.

Sahi, since it is aimed at testers rather than developers, does not encourage use of XPath, which means that you can use it if you want, but the controller will never show you XPaths.

So how does Sahi handle something like this?

My name Edit
Your name Edit
His name Edit

Simple, Sahi uses the _in and _near APIs.

So to access the edit link of Your name, use

_link(“Edit”, _near(_cell(“Your name”)))

Like wise

_link(“Edit”, _near(_cell(“My name”)))
_link(“Edit”, _near(_cell(“His name”)))

Visit us again or subscribe to this blog for more tips on web automation …

Use fully-loaded Sahi Pro FREE for a month. Download Now Request a Demo