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.

Reading of javascript from page

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

I would like to ask if is it possible to get values from javascript of tested page by using Java.

Example:
Following code of javascript is on the tested page.

...
function(){
var cities = ["Prague","London", "Paris"];
}
...

and I need to get values from the list by using Java.
Is it any way to do?

Thanks Martin

Comments

  • narayannarayan Administrators
    Hi Martin,

    Does this function have a name?
    You can do

    browser.fetch("yourFunction()");

    to get a string representation of the array. You can then parse it.

    Regards,
    Narayan
  • MarSilMarSil Members
    Thanks for reply. It works. :-)

    Thanks,
    Martin


    Description:

    I took the name of method from DOM by Firebug. Inner functions are separated by dot. ("permanentAddress.init")
Sign In or Register to comment.