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.

Sahi Recording seems to use Value rather than Name or ID with _button

RobinLRandallRobinLRandall Members
edited February 2009 in Sahi - Open Source
When I record clicking a button I get:

_click(_button("Yes");

rather than:

_click(_button("button1"); (See " _button" API reference)

This is a bug since Value is not used as an identifier.

Below is the code: type "button" assessor set to "value" before id, title, name or alt

Sahi.prototype.findElement = function (id, type, tagName) {
var res = this.getBlankResult();
var retVal = null;
if (tagName == "button"){
retVal = this.findElementHelper(id, this.top(), type, res, (this.isIE() ? "innerText" : "textContent") , tagName).element;
if (retVal != null) return retVal;
} else if (type == "button" || type == "reset" || type == "submit") {
retVal = this.findElementHelper(id, this.top(), type, res, "value", tagName).element;
if (retVal != null) return retVal;
}
else if (type == "image") {
retVal = this.findElementHelper(id, this.top(), type, res, "title", tagName).element;
if (retVal != null) return retVal;
retVal = this.findElementHelper(id, this.top(), type, res, "alt", tagName).element;
if (retVal != null) return retVal;
}

res = this.getBlankResult();
retVal = this.findElementHelper(id, this.top(), type, res, "name", tagName).element;
if (retVal != null) return retVal;

res = this.getBlankResult();
return this.findElementHelper(id, this.top(), type, res, "id", tagName).element;
}


RR

Comments

  • This "bug" turned out worse than I thought. Perhaps it is a memory problem. Anyway, the window is a second instance of IE. The button, labeled "Fax" works when you push it, bringing up a Modal Dialog window. Some of the HTML is below so you can see the Assessor should be '_button("btnFax")' but Click does not work when in record mode and "Test-->" does not work either if I have
    '_click(_button("btnFax")' in the textbox. On Playback I a
    --Stopped Playback: FAILURE-- after this step. The Alternative does not work either. In the logfile it says:

    TypeError: 'null' is null or not an object
    No trace available Click for browser script [object JavaObject] at Feb 3, 2009 9:18:38 PM

    When I double-click, all I see is a "1" which is greyed out. (Usually it is a listing of the script with the "bad" step highlighted.) I tried clearing the browser and killing all unneeded programs but maybe three windows deep is too much for my machine. Any help resolving this is appreciated.

    =================================================
    Record Dialog:
    [Props]
    Assessor" [_button("Fax") ] [Click ]
    Alternative: [top.document.getElementById("btnFax")] [Hilight]
    Value: [ ] [ Set ]

    [Test --> ]

    ==================================================
    The HTML
    <input name="btnFax" type="button" id="btnFax" value="Fax" style="margin-left:5px;font-size:8pt;" onclick="showFaxPage();" />
  • Below is what appeared from sahi.bat when I ran the script:

    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
    at net.sf.sahi.StreamHandler.setRawHeaders(StreamHandler.java:102)
    at net.sf.sahi.StreamHandler.populateHeaders(StreamHandler.java:51)
    at net.sf.sahi.request.HttpRequest.<init>(HttpRequest.java:75)
    at net.sf.sahi.ProxyProcessor.getRequestFromBrowser(ProxyProcessor.java:226)
    at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:64)
    at net.sf.sahi.ProxyProcessor.processConnect(ProxyProcessor.java:210)
    at net.sf.sahi.ProxyProcessor.processAsProxy(ProxyProcessor.java:119)
    at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:84)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)

    RR
Sign In or Register to comment.