使用selenium和C#获取excel打开错误以实现自动化 [英] Getting error on excel opening with selenium and C# for automation

查看:94
本文介绍了使用selenium和C#获取excel打开错误以实现自动化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi All,

I am working with Selenium and C# for Automation.
one of our requirement that we have to open an excel sheet and some calculate some values like filters, count, Ave etc.

I have used below code, but I got an error.

Note: I am using Microsot Excel 2007.

Thanks,





我尝试过:





What I have tried:

Excel.Application x1Appl = new Excel.Application();
Excel.Workbook x1WorkBook = x1Appl.Workbooks.Open(@"C:\Users\User1\Desktop\Test.xlsx");

Nuget Package "Microsoft.Office.Interop.Excel".

error was: "System.Runtime.InteropServices.COMException: 'Exception from HRESULT: 0x800A03EC'"

推荐答案

您需要在机器上安装Excel并正常工作。 Interop.Excel只是一个c#接口,可用于自动化Excel,但Excel必须在机器上才能实现自动化。
You need Excel installed on the machine and working. Interop.Excel is just a c# interface that can be used to automate Excel, but Excel has to be on the machine in order for it to be automated.


这篇关于使用selenium和C#获取excel打开错误以实现自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆