Sahi Tutorials
January 5, 2010

Web automation does not need XPaths

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 nameEditYour nameEditHis nameEditSimple, 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 ...

Continue reading

A Usual Day at the Office

Tip of the Day 9