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.

Click "print" link not work with sahi

fionfion Members
edited November -1 in Sahi - Open Source
Hi all,

Recently I'm doing web automation with sahi, and It's a great tool, but there is a problem when I click a link "print" in a page, <a class="printIcon" href="javascript:window.print();">Print</a>

When I record the script,_click(_link("Print")) will popup print page, but it just no response when I execute the script, and in the test report, there is no error display, I use _navigateTo(_link("Print").href, true); in Chrome, page not loaded, just go ahead to next step, and in firefox4, navigate to a blank page.

Using sahi os 20110719

Can someone help me out of this, thanks advance.

Thanks,
Fion

Comments

  • You could maybe _call("window.print()") instead?

    Regards
    Wormi
  • fionfion Members
    edited September 2012
    Hi Wormi,

    Thanks for your quick response.

    Still not work, I have tried _call("window.print()"); or _eval("window.print()"); still no response in chrome

    Thanks,
    Fion
  • Hi all,

    can anyone who has idea of this, please help?

    Thanks,
    Fion
  • narayannarayan Administrators
    Hi Fion and Wormi,

    Print is one of those APIs that Sahi suppresses during playback because it blocks playback (like alert, confirm etc.)

    If you want to verify that print was called, do

    _assert(_printCalled());

    If you want to explicitly see the print coming up, you can call
    _print()
    But this will block further execution of script.

    Hope that helps.

    Regards,
    Narayan
  • Hi Narayan,

    Thanks for interpretation why print can not work when playback.

    Thanks,
    Fion
This discussion has been closed.