实现效果:选择本地Excel文件,excel名称显示在ComBoBox中,excel内容显示在DataGridView中,点击"Send Web to Test" 按钮,就会进行相关测试。
Form1.cs代码如下:
using System;
using System.Data;
using System.IO;
using System.Windows.Forms;
using Excel;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;
namespace ReadExcel4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
DataSet result = null;
private void button1_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Excel Workbook|*.xls", ValidateNames = true })
{
if (ofd.ShowDialog() == DialogResult.OK)<