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.

How to inject javascript into Ajax web application using sahi ?

wuqingjikewuqingjike Members
edited November -1 in Sahi - Open Source
Hi,
I want to extend Sahi .I want to inject some javasript program into Ajax web sites pages and monitor the running of the Ajax application.Can anybody give me some ideas? thanks in advance

Comments

  • narayannarayan Administrators
    Wuqingjike,

    Just add your script file in sahi/config/inject_top.txt
    It will get injected in all HTML files.

    If you want to access any Sahi APIs from your script, remember to add your script file after state.js (or later) and prepend all Sahi API calls with _sahi in your script.

    For example if you want to get the text of an element, use
    _sahi._getText(yourElement)

    Let us know what you are planning to do so that we can learn from your experience.

    Regards,
    Narayan
  • Hi,Narayan
    Thank you for your reply!! I want to tell you more about what i plan to do . I want to extend sahi for monitoring and detecting failures in client-side code.That is: inject a client agent into the web application's code and use a sahi-side component to collect the monitoring data from the agent ,then,analyze the collected data ,controll it and take corrective actions through the agent.
    Could you please tell me if it's possible to implement it using sahi and give me some suggestions ?
Sign In or Register to comment.