附加webdriver的硒对火狐已经打开

附加webdriver的硒对火狐已经打开

本文介绍了附加webdriver的硒对火狐已经打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的集成测试的C#库。其中一个被测试在我的.NET code的步骤是打开火狐适当的URL地址。我的集成测试应该提供一些数据,我的图书馆,等待火狐将推出,并检查该网页所包含正确的数据。要使用硒我必须以某种方式连接到Firefox正在吃午饭我的图书馆。是否有可能与硒?是否有任何其他图书馆,可以帮助我吗?

I'm working on integration test for C# library. One of the steps in my .NET code being tested is to open Firefox with proper url address. My integration test should provide some data to my library, wait for firefox to be launched and check if the web page contains proper data. To use selenium I have to attach somehow to firefox being lunched by my library. Is it possible with Selenium? Are there any other libraries which could help me?

推荐答案

这是容易做到与华廷

文档,解释附加到现有的浏览器是这里

Documentation that explains attaching to an existing browser is here.

什么,你就需要在您的测试附加到开辟库中的浏览器做虽然要点基本上是:

The gist of what you'd need to do though in your test to attach to the browser opened up by your library is basically:

// make library call that creates Firefox here
// ...

var browser = Browser.AttachTo<Firefox>(Find.ByUrl(MyUrl)); // or use another way of finding your browser instance if you wish

// do tests with browser variable using WatiN's API (an obvious first step is to fail test if browser is null)

这篇关于附加webdriver的硒对火狐已经打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 03:48