首页 > 解决方案 > C# Selenium 谷歌表

问题描述

我有代码:

driver.Navigate().GotoUlr("https://www.youtube.com/")
driver.FindElement(By.LinkText("abcd").Click();

我想在每次运行时导入许多链接以不更改代码,例如:

在谷歌表中:

colum 1:
youtube.com
google.com
bing.com
....about 100 lines

colum 2:
abcd
zxcv
mkopdsh
yuiofhxd
....about 100 lines

google sheet online 示例

我怎么能用 C# 做到这一点。

标签: c#selenium-webdrivergoogle-sheets

解决方案


您最好的选择是将您的 excel 文件导入可执行文件的目录中。

然后您可以使用 HtmlAgilityPack 包将其打开并解析为 xml。另一种选择是使用 EPPlus 将其打开并解析为 excel 文件。


推荐阅读