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.

passing value to URL

kapilkapil Members
edited November -1 in Sahi - Open Source
hello sumitra,

kapil here... ihave doubt...that
In my application system opens new window by generating invoice ID and taking Invoice number in URL.
i can generate the invoice number by using Random () API. but the invoice ID is system generated and incremented by one each time...
my problem is how to pass that invoice no and invoice ID to URL in script so that System can open that window of that Invoice Number and invoice ID.....

Please suggest me solution so that i can proceed further..

Regards,

kapil

Comments

  • Hi Kapil,

    with reference to the script you placed in your previous forum,
    1. After click _submit(upload document), check if there's an element storing the newly generated invoice id.

    2. if there is, get the accessor and the value.

    3. pass this as a parameter to _navigateTo like the following code

    _navigateTo("http://development.itsiwc1.com/AP.InterfaceLayer/APInvoice/AddEditInvoiceDocument.aspx?mode=Add&ProjectNumber=00118.0200&InvoiceId="; + $invoiceID+ "&InvoiceNumber=" + $invoiceNumber + "&InvoiceDocumentId=0");
    /*  Eg: 
    For this,
    <input type="hidden" id="invoiceID"/>
    <input type="text" id="invoiceNumber"/>  */
    var $invoiceID=_getValue(_hidden(invoiceID));
    var $invoiceNumber=_getText(_textbox(invoiceNumber));
    _navigateTo("http://development.itsiwc1.com/AP.InterfaceLayer/APInvoice/AddEditInvoiceDocument.aspx?mode=Add&ProjectNumber=00118.0200&InvoiceId=" + $invoiceID+ "&InvoiceNumber=" + $invoiceNumber + "&InvoiceDocumentId=0");
    
    

    Regards,
    Theeran.
  • kapilkapil Members
    Hi theeran,

    Thanx for the reply... my scripts is changed I am posting it here again .

    so according to that suggest me solution.

    _click(_cell("Enter Invoice"));
    _click(_button("dbcPurchaseOrder_ulbSearchButton"));
    _setSelected(_select("dbcPurchaseOrder\$ulbDropDown"), "0011806");
    _setValue(_textbox("txtInvoiceNumber"), "9054");
    _setValue(_textbox("dtpInvoiceDate"), "07/28/2011");
    _setValue(_textbox("dtpDateReceived"), "07/25/2011");
    _setValue(_textbox("txtInvoiceAmount"), "100");
    _setValue(_textarea("txtInvoiceDescription"), "machhindra");
    _click(_submit("Edit"));
    _setValue(_textbox("dtgrdTaskDistribution\$ctl02\$txtDistribution"), "100.00");
    _click(_submit("Update"));
    _click(_submit("Upload New Document"));
    _wait(4000);
    _call(window.location.reload());
    _navigateTo("http://development.itsiwc1.com/AP.InterfaceLayer/APInvoice/AddEditInvoiceDocument.aspx?mode=Add&ProjectNumber=00118.0200&InvoiceId=5444&InvoiceNumber=9054&InvoiceDocumentId=0";);

    _setValue(_textbox("txtDocument"), "kapil");
    _setFile(_file("fileUploadInvoiceFile"), "C:\\fileupload\\Test.txt");
    _setFile(_file("fileUploadInvoiceFile"), "C:\\fileupload\\Test.txt");
    _call(_file("fileUploadInvoiceFile").outerHTML = '<input name="fileUploadInvoiceFile" type="text" id="fileUploadInvoiceFile" size="40" value value="C:\\fileupload\\Test.txt" />');
    _click(_submit("Save"));
    _click(_submit("Save & Submit"));


    Regards,

    As my upload file is also not working properly thats why i will have to again navigate in to that page...
    so will u please suggest me any other sytax for file upload ....

    Regards,

    kapil
Sign In or Register to comment.