Message: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5

book

Article ID: 6909

calendar_today

Updated On:

Products

CA Application Test Service Virtualization CA Continuous Application Insight (PathFinder) CA Service Virtualization (DevTest / LISA / VSE / Application Test)

Issue/Introduction

I have this segment of JavaScript code 

 

var Excel; 

var fileName = "C:/NCPDP/Data/getMedOrders/MRNandTwoPrescriptionNumbers.xlsx"; 

Excel = new ActiveXObject("Excel.Application"); 

Excel.Visible = false; 

var book = Excel.Workbooks.Open(fileName); 

var sheet=book.Sheets.Item(1); 

var data=sheet.Cells(1,1).Value; 

 

testExec.setStateValue("cellValue", data); 

 

I got the following error when launch ITR 

 

============================================================================ 

| Error in Script 

============================================================================ 

| Step: Execute script (JSR-223) 

---------------------------------------------------------------------------- 

| Message: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5 

---------------------------------------------------------------------------- 

| Trapped Exception: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5 

| Trapped Message: javax.script.ScriptException: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5 

-----------

Environment

Release: LSASVR99000-9.5-LISA-Server
Component:

Resolution

ActiveX is only in Internet , so this will not work in for IE browsers, ergo not work in DevTest. 

What I suggest is to post this on Communities for any suggestions. 

Here are a few links that might be helpful. 

"http://codetheory.in/parse-read-excel-files-xls-xlsx-javascript/" 

"http://psjinx.com/programming/2014/01/04/parsing-excel-workbooks-using-javascript/"