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.

_check(_checkbox) is not working on chrome

gkadamgkadam Members
edited November -1 in Sahi - Open Source
Hi Narayan

I have tried following code..
_check(_checkbox("ShowSubLanes"));
This line execute without any error
but checkbox not get checked on chrome browser

Same line execute fine on firefox browser

Regards
gkadam

Comments

  • AditeeAditee Members
    edited November 2010
    I faced similar problem. I also tried to record the same but when I tried to play back the recorded code, it does not work.

    Aditee
    (Digite Infotech)
  • Hi gkadam and Aditee,

    _check(_checkbox("checkboxName"));
    works fine on the Chrome browser(7.0.517.41) on the Sahi Build: 2010-06-11.
    Let us know which version of Chrome browser and which version of Sahi Build you are using.
  • We are using following versions

    Google Chrome Browser - 8.0.552.18

    Sahi - 2010-10-04

    Regards,
    Aditee
    (Digite Infotech)
  • AditeeAditee Members
    edited November 2010
    We have checked following code for checkbox which works for build combinations

    1. Chrome - 8.0.552.18
    Sahi - 2010-06-11

    2. Chrome - 8.0.552.18
    Sahi - 2010-10-04

    code -
    _call(_sahi.simulateMouseEvent(_checkbox("checboxName"), "click"));

    but _check does not work for the same

    Regards,
    Aditee
    (Digite Infotech)
  • narayannarayan Administrators
    Could you please try with the latest Sahi, released on Nov 3?

    Regards,
    Narayan
  • Hi Narayan

    We have make some change sahi code

    "Sahi.prototype.simulateClick = function (el, isRight, isDouble, combo) {
    var n = el;

    var link = this.getEncapsulatingLink(n);
    if (link != null){
    link.__sahi__prevClick = link.onclick;
    var elWin = this.getWindow(link);
    link.onclick = function (e) {
    // test with docWriteIFrame
    return _sahi.wrap(_sahi.linkClick)(e ? e : elWin.event);
    };

    }

    this.simulateMouseEvent(el, "mousemove");
    this.simulateMouseEvent(el, "mouseover");
    this.simulateMouseEvent(el, "mousedown", isRight, false, combo);
    this.invokeLastBlur();
    this.simulateMouseEvent(el, "focus");
    this.simulateMouseEvent(el, "mouseup", isRight, false, combo);
    if (isRight) {
    if (window.opera){
    this.simulateMouseEvent(el, "click", isRight, isDouble, combo);
    }else{
    this.simulateMouseEvent(el, "contextmenu", isRight, isDouble, combo);
    }
    } else {
    try {
    if (this._isIE() && !isDouble && el && (this.areTagNamesEqual(el.tagName, "LABEL") ||
    (el.type && (el.type == "submit"
    || el.type == "reset" || el.type == "image"
    || el.type == "checkbox" || el.type == "radio")))) {
    el.click();
    } else {
    if (window.opera && !isDouble){
    // for opera single clicks don't simulate click event;
    }
    else {
    if (this.isSafariLike()) {
    if (this.areTagNamesEqual(el.tagName, "INPUT")) {
    if (typeof el.checked == "boolean") {
    el.checked = (el.type == "radio") ? true : !el.checked;
    _sahi.simulateMouseEvent(el, "change");
    }
    }
    }
    // change made here else{
    this.simulateMouseEvent(el, "click", isRight, isDouble, combo);
    }
    }
    }
    } catch(e) {
    }
    }

    if (!this.isSafariLike()){
    this.setLastBlurFn(function(){
    try{
    _sahi.simulateMouseEvent(el, "mousemove");
    _sahi.simulateMouseEvent(el, "mouseout");
    if (!_sahi._isFF() && (el.type == "checkbox" || el.type == "radio")){
    _sahi.simulateMouseEvent(el, "change");
    }
    _sahi.simulateMouseEvent(el, "blur");
    }catch(e){}
    });
    }
    if (link){
    link.onclick = link.__sahi__prevClick;
    }
    };
    "

    i guess there was else statement missing at following
    if (this.isSafariLike()) {}
    this.simulateMouseEvent(el, "click", isRight, isDouble, combo);

    After code change we are able to check/uncheck checkbox on chrome and Firefox.
    But we are still facing problem in IE version 8
    so could you please help us out..
  • narayannarayan Administrators
    Hi Ganesh,

    _check is actually working on the 3rd Nov build. You can verify on this page
    http://sahi.co.in/demo/formTest.htm

    Let us do a desktop share session to see what is happening in your case.

    Unless you understand exactly how the events are generated and what the sequence is, I would suggest, don't modify those functions in concat.js

    Regards,
    Narayan
  • ich.netich.net Members
    edited February 2011
    I'm facing the same Problems with current Google Chrome (9.0.597.84).

    Even _click and highlight is not working for checkboxes (also tested formTest.htm-URL (can not post urls) from narayan with Sahi Controller).

    Version of Sahi: Build : 2010-11-03
  • JicmJicm Members
    edited February 2011
    ich.net wrote:
    I'm facing the same Problems with current Google Chrome (9.0.597.84).

    Even _click and highlight is not working for checkboxes (also tested formTest.htm-URL (can not post urls) from narayan with Sahi Controller).

    Version of Sahi: Build : 2010-11-03


    Version : V3
    Build : 2010-11-03

    UserAgent : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.84 Safari/534.13
    Name : Safari
    Version : 5.0 (Windows; U; Windows NT 5.1; en-US)

    i'm facing the same problem in a new script i'm recording, but in a different script it works fine; the script is the one i post in here http://sahi.co.in/forums/viewtopic.php?id=2087
    <input type="checkbox" name="user_id" value="344458" id="lab_members.344458" title="Check/uncheck this row, and select an action to perform below">
    <input type="checkbox" name="user_id" value="344487" id="lab_members.344487" title="Check/uncheck this row, and select an action to perform below">
    
     _click(_checkbox("user_id"));
     _click(_checkbox("user_id[1]"));
    
     _check(_checkbox("user_id"));
     _check(_checkbox("user_id[1]"));
    
  • narayannarayan Administrators
    ich.net,
    Confirmed that this bug exists with the latest release of Chrome and has been fixed and will be available in the next release, to be made in a day or two.
  • Hi narayan
    i just installed the V3.5 and faced the same problems. On firefox, everything works well, but on chromium-browser, checking or clicking of radio buttons isn't possible.
    I'm using the latest Sahi version and Chromium 8.0.552.237 Ubuntu 10.04
  • I have no idea what changed, but with the chromium browser it's working fine again.
  • I tried to fix this in my local refering to solutions mentioned in topics,
    http://sahi.co.in/forums/viewtopic.php?id=2196
    http://sahi.co.in/forums/viewtopic.php?id=1907

    I also tried testing on this page : http://sahi.co.in/demo/formTest.htm
    It does not work with latest version of Sahi OS [v35] and Chrome.

    Altough It does recognizes checkbox by id, name, class in record window; It fails to play the recorded syntax.

    I tried using
    _click(_checkbox("agreeCheckbox"));
    _check(_checkbox("agreeCheckbox"));
    _click(_check("agreeCheckbox"));
    _check("agreeCheckbox");
    All FAILS.
    Someone needs to log this as a defect.

    Hopefully this is will be available in next version of Sahi OS.
  • All,

    Found some workaround for this issue,
    For now you can try using:
    _checkbox("agreeCheckbox").click()
    This Works.
Sign In or Register to comment.