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.

How to capture data from firefox and export to excel

gunjangunjan Members
edited November -1 in Sahi - Open Source
hi,

can u plz help me
my excel sheet data is given below


Firstname Lastname DaytimePhoneP1 DaytimePhoneP2 Email Year Make


Model Color


Year, make model and color drop down values are selected
Year= 2001,2002 etc
Make=Audi,BMW etc
Model= A4, 3 series etc
Color=blue,Black etc
DaytimePhoneP1 consider only 3 digits
DaytimePhoneP2 consider 7 digits


Can u plz tell me what the script should i write for above situation




Thanks,
Gunjan

Comments

  • Hi gunjan,

    To export the data from Browser to excel sheet,try the following script,
    _setValue(_textbox("textbox1id"), "textbox1value");
    _setValue(_textbox("textbox2id"), "textbox2value");
    _setSelected(_select("dropdown1id"), "selectedoptionvalue1");
    _setSelected(_select("dropdown2id"), "selectedoptionvalue2");
    var $textbox1value=_getText(_textbox("textbox1id"));
    var $textbox2value=_getText(_textbox("textbox2id"));
    var $selectedoptionvalue1=_getSelectedText(_select("dropdown1id"));
    var $selectedoptionvalue2=_getSelectedText(_select("dropdown2id"));
    var dba =_getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ="path to excel file";readOnly=false", "", "");
    dba.update("insert into [Sheet1$] (textbox1value,textbox2value,selectedoptionvalue1,selectedoptionvalue2) values ('"+ $textbox1value +"','"+ textbox2value +"','"+ $selectedoptionvalue1 +"','"+ $selectedoptionvalue2 +"')");
    

    This might help you.
    let us know,if the problem persists.

    Regards
    Theeran.
  • Hi Threen,
    in my previous post i supposed to ask the same thing but i was confuse..so her eis my actual query..
    i have Excel sheet with below table structure and i want insert the row ino that excel and i gone thru the above post and wrote the same in my code..please have look and please help me out wher i have done mistake...


    First_Number Second_Number Action Total
    1000 20 Add 30
    20 10 Sub 10
    10 10 Multi 100
    100 20 Div 5


    here i want to insert new line ..





    var ExObj=_getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=D:\\Sahi Practice\\InputData\\Update_SampleData.xls;readOnly=false", " ", " ");


    var $textbox1value,$textbox1value2,$textbox1value3

    $textbox1value="Sandeep";
    $textbox1value2="Sandeep2";
    $textbox1value3="Sandeep3";
    $textbox1value4="Sandeep4";

    ExObj.update("insert into [Sheet1$] (First_Number, Second_Number, Action, Total) Values ('"+ $textbox1value +"', '"+ $textbox1value2 +"', '"+ $textbox1value3 +"', '"+ $textbox1value4 +"')");




    Regards,
    Sandeep S S
  • Hi Can you please update on this...
Sign In or Register to comment.