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 get innertext of browser

john_qajohn_qa Members
edited November -1 in Sahi - Open Source
Hello,

I'm trying to get the innertext value of a browser, or more clearly of the "<body>" of a browser. I want it to work on Android browser.

I'm using java and I have tried browser.byxPath("/html/body").getText(), but android browser doesn't support xpath.

Can you give some sugestions? I hope is not a stupid question, but I've just started trying to do something with sahi.

Thanks,
Ioan

Comments

  • Hi Ioan,

    Try this:
    browser.accessor("document.body").getText();
    

    Regards,
    dkulkarni
  • Thank you for the answer. It worked perfectly.

    I've also used successfully
    browser.fetch("document.body.innerText");
  • Ioan,

    Your solution would work only on Internet Explorer though. The innerText property is used only in IE.

    Regards,
    dkulkarni
Sign In or Register to comment.