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.

is there any substitute for _call and _set APIs in java using java driver?

SaiPradeepSaiPradeep Members
edited August 2013 in Sahi - Open Source

Hi all,

<browser>
function getattributeElement(attribute,value)
{
var allElements = document.getElementsByTagName("*");
for(i=0;i<allElements.length;i++)
{
if (allElements.getAttribute(attribute) == value)
{
return allElements;
}
}
}
</browser>
_set($attrElements,getattributeElement("name","password"));
_highlight($attrElements);
var $b = _accessor($attrElements);
_setValue($b,"secret");
</browser>
_call(function()) and _set($a,function()).

just as equivalent to the above code, I have written in the Java driver.

browser.setBrowserJS("function clue() {var c = document.getElementsByTagName('input')[0]; return c;}");
browser.navigateTo("http://sahi.co.in/demo/training/login.htm";);
System.out.println(browser.fetch("clue()"));

in the console:[object HTMLInputElement] this is the element returned by the function inside the browser.
when trying to access the element above I am getting the error.
browser.accessor(browser.fetch("clue()"));

kindly please help me out on this scenario.

Thanks,
Sai pradeep

Answers

Sign In or Register to comment.