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.

XPath in IE

tower120tower120 Members
edited November -1 in Sahi - Open Source
Hi!

When we use selenium we mark all elements for test with tag selenium_id = smth. Now we need somehow to use this in Sahi. As I understand, we must use _byXPath. But we can't make it work under IE. We already add sahi\htdocs\spr\javascript-xpath.js ...

Comments

  • narayannarayan Administrators
    Hi tower120,

    Can you post a sample html tag?

    Thanks,
    Narayan
  • <div class="floatLeft sgImage" selenium_sgimage="0">
  • narayannarayan Administrators
    Hi tower120

    Could you please explain a little more, with a few more examples? We may be able to identify the elements in Sahi without using XPaths.

    Regards,
    Narayan
  • Well, there are few images inside divs, they all are inside div with vertical scrollbars.

    <div id="srollbars">
    <div class="floatLeft sgImage" selenium_sgimage="0">
    <img src=""/>
    </div>
    <div class="floatLeft sgImage" selenium_sgimage="1">
    <img src=""/>
    </div>
    <div class="floatLeft sgImage" selenium_sgimage="2">
    <img src=""/>
    </div>
    <div class="floatLeft sgImage" selenium_sgimage="3">
    <img src=""/>
    </div>
    </div>

    I need to drag and drop each image somewhere...
    May be I could use smthg like sgImage[1], sgImage[2] etc. but inside div with overflow this accessors unfortunately work not correct (same as with Selenium). I mean the first element that Sahi select depends on the position of scrollbar (it may be real 6th or 9th element if we scroll scrollbar to the end and first elements be in invisible area). If you let me, I can post a link to the problem page on Monday

    Thank you, for your aid.
  • narayannarayan Administrators
    Hi,

    You should now be able to post URLs. You can also email us at support@sahi.co.in with screen shots and more information if needed.

    Regards,
    Narayan
  • Hi,

    Go here http://www.optimalprint.com/en-US/edit_design_v3?design_id=xN9xmGf_PW0&iqs=1 , click yellow button "Upload additional images" and upload 13 images. The task is to drag and drop each picture to each slot from right.

    I use this:
    for (var $i=1; $i<=13; $i++) {
    var $index = 1;
    if ($i>=2){
    $index = ($i-1)*2;
    }

    //lets suppose - we have uploaded images

    _dragDrop( _image("sgImg ui-draggable["+ parseInt($i-1) +"]"),
    _div("qis_page_" + $index + "_thumb")
    );
    }

    If scrollbars in top of page it drag an drop one set of images, if at the bottom - another. Tested under IE.

    By the way - try to press CTRL and inspect elements accessor in uploaded images from left. When you scroll them - counter goes astray.
  • By the way, is it possible to specify FF profile location for Sahi? I want to use my Firebug.
  • narayannarayan Administrators
    You can do 2 things:

    1) Open firefox from the Dashboard, turn off its proxy settings, install firebug there and then set the proxy back to localhost 9999

    2) Open sahi/userdata/browser_config.xml, create a new browserType node with name say SahiFirebug, and point to your profile.

    Hope that helps,
    Regards,
    Narayan
  • And what about XPath and accessors? :)
Sign In or Register to comment.