本文介绍了如何在 C# 中使用 Selenium?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
硒.
我下载了 C# 客户端驱动程序和 IDE.我设法记录了一些测试并成功地从 IDE 运行它们.但现在我想使用 C# 来做到这一点.我将所有相关的 DLL 文件 (Firefox) 添加到项目中,但我没有 Selenium 类.一些你好,世界!会很好.
I downloaded the C# client drivers and the IDE. I managed to record some tests and successfully ran them from the IDE. But now I want to do that using C#. I added all relevant DLL files (Firefox) to the project, but I don't have the Selenium class. Some Hello, World! would be nice.
推荐答案来自 Selenium 文档:
using OpenQA.Selenium.Firefox; using OpenQA.Selenium; class GoogleSuggest { static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); //Notice navigation is slightly different than the Java version //This is because 'get' is a keyword in C# driver.Navigate().GoToUrl("www.google/"); IWebElement query = driver.FindElement(By.Name("q")); query.SendKeys("Cheese"); System.Console.WriteLine("Page title is: " + driver.Title); driver.Quit(); } }更多推荐
如何在 C# 中使用 Selenium?
发布评论