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 can I get the HTML source of the current page?

MaurusMaurus Members
edited November -1 in Sahi - Open Source
Hi,

How can I get the source of the current page as String using Sahi Java Driver, so that I can check if the page contains any string?
I would like to use regular expressions for the string search.

Many thanks Maurus

Comments

  • Hi Maurus,

    You can use something like this:

    String res = browser.fetch("document.body.innerHTML");

    Regards
    Sumitra
Sign In or Register to comment.