18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

can anyone use byXPath method in Java driver successfully?

ligangligang Members
edited November -1 in Sahi - Open Source
I guess it can't work at all.

I know Sahi has many locating methods. However, there are many complex applications in which Sahi can't work well. Sahi provides byXpath method in Java drivers, but I found it can't work at all.

Also search the forum, som persons also faced this issue. But it seems nobody want to fix it . With xpath as a supplement, sahi will be more powerful.

Hopefully Sahi group can fix this issue in new releases.

Comments

  • narayannarayan Administrators
    Hi ligang,

    You can locate almost anything with out XPaths. If you have to depend on XPaths, you mostly are looking at the UI from a code perspective. Step back and see if the same can be done with near, in, under etc.

    Now that I have expressed my rant, let us enable XPaths for you.

    Could you tell us what browser you are using?

    XPaths are natively enabled on Firefox. For IE you need to do a little more. Go to sahi/htdocs/spr/ext/javascript-xpath directory. There is a README.txt which has the instructions given below:
    ---
    For browsers without XPath support, use Javascript-XPath: (http://coderepos.org/share/wiki/JavaScript-XPath)
    Copy the contents from
    http://svn.coderepos.org/share/lang/javascript/javascript-xpath/trunk/release/javascript-xpath-latest.js
    and save it in a file with name javascript-xpath.js in this same directory

    Sahi will look for this file at spr/ext/javascript-xpath/javascript-xpath.js

    This file is under its own MIT license and is not part of Sahi's code base
    ---

    Follow the instructions and check if it works for you. If not, let us know.

    Regards,
    Narayan
  • ligangligang Members
    Wow!, Narayan, thank you so much. You solved my a big trouble. So far I can use this workaround.

    Yes, I used IE browser. before that I took so much time to find how to use xpath in IE.

    So far It is sovled perfectly. Thanks again.
This discussion has been closed.