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.

Use of Concatenate command in message validation

RahulRahul Members
edited November -1 in Sahi - Open Source
Getting syntax error message when i use concatenate option in assert command

In my testing example i have to click on the date based tab and then observe the message displayed here message contains of static and dynamic part.Here the dynamic message is a date that depends on which tab we click on the testing environment

When i use the concatenate to combine this dynamic message by fetching the date from the server(using get db) i am getting syntax error message

I am comparing the message using asserexist,assertvisible,assertequal,assetcontains Text method

Can any one please let me know the solution to fix this issue

Comments

  • Hi,
    Can you post your code

    Regards,
    tejas269
  • RahulRahul Members
    I have pasted the code.Here X and Y are static messages

    var $rt = $db.select(" SELECT DATE_FORMAT(curdate() - INTERVAL 3 DAY, '%b %d') ");
    _alert($rt[0][0]);
    _click(_div("gwt-Label add-task-link[0]"));
    _assertExists(_div("gwt-Label message-board-text info-message"));
    _assert(_isVisible(_div("gwt-Label message-board-text info-message")));
    _assertEqual("X : "+"($rt[0][0])"+" . Y., _getText(_div("gwt-Label message-board-text info-message")));
    _assertContainsText("X : +"($rt[0][0])"+ . Y.", _div("gwt-Label message-board-text info-message"));
  • ashokashok Members
    Rahul,

    declare two variables and assign the messages to the variable. Then compare. It will work.

    thanks,
    -ashok.
  • RahulRahul Members
    After declaring two variables also i am getting following error message

    assertEqual("You are not allowed to fill current day timesheet as your previous entries are blank for the days :" + "$date[0][0] " + ". Please check and enter your previous blank days or apply for leaves accordingly" , _getText(_div("gwt-Label message-board-text info-message")));
    Error: The parameter passed to _getText was not found on the browser at Jul 24, 2012 11:05:14 AM
  • RahulRahul Members
    Pasted the code below:

    var $date = $db.select(" SELECT DATE_FORMAT(curdate() - INTERVAL 1 DAY, '%b %d') ");
    _alert($date[0][0]);

    var $X = "You are not allowed to fill current day timesheet as your previous entries are blank for the days :" ;
    var $Y=". Please check and enter your previous blank days or apply for leaves accordingly";


    _click(_div("gwt-Label add-task-link[2]"));//2nd june
    _assertExists(_div("gwt-Label message-board-text info-message"));
    _assert(_isVisible(_div("gwt-Label message-board-text info-message")));
    _assertEqual($X + "$date[0][0] " + $Y , _getText(_div("gwt-Label message-board-text info-message")));
    _assertContainsText($X + "$date[0][0] " + $Y , _div("gwt-Label message-board-text info-message"));
  • try with not putting $date[0][0] in double quotes
    var $str= X+ $date[0][0]+ Y;
    and then compare the $str with the message you want displayed

    Regards,
    Tejas
  • mohanmohan Members
    Are you using EXTJS frame work?
  • RahulRahul Members
    Hi Mohan,

    We are not using EXTJS frame work.We are using GWT

    Regards,
    Rahul
Sign In or Register to comment.