OpenQA.Selenium.DriverServiceNotFoundException [英] OpenQA.Selenium.DriverServiceNotFoundException

查看:71
本文介绍了OpenQA.Selenium.DriverServiceNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试运行OrderedTest,但获取"OpenQA.Selenium.DriverServiceNotFoundException"例外。当我单独运行TestMethods时,它们工作正常。但是当我将测试添加到OrderedTest时,我得到了上述异常。我的
ChromeDriver.exe文件位于bin / Debug文件夹中。


我理解TestMethod执行和OrderedTest执行的路径不一样,要解决我尝试在Test Class之前添加[DeploymentItem(chromedrive.exe)]属性的问题。


请帮我解决问题。


提前致谢!


问候,


Aman Shukla

解决方案

嗨shukla1292,


您使用的是哪个版本的Visual Studio?


你添加了吗?对你的OrderedTest进行单元测试?


我用单元测试测试它,我可以重新调试你的问题。




请删除项目中的"chromedriver.exe",并在代码中指定该文件的调用路径,请参考以下代码示例:


IWebDriver chromeDriver =
new ChromeDriver( " C:\\Program Files
(x86)\\Common Files \\ Myrosoft Shared\\VSTT \\ Cross Browser Selenium Components"
);


更改代码后,请重新构建解决方案,然后重新运行测试方法。然后运行OrderedTest。
这在我这边工作正常。


问候,


Judyzh


Hi,

I am trying to run an OrderedTest, but getting "OpenQA.Selenium.DriverServiceNotFoundException" exception. When I run the TestMethods individually, they are working fine. But when I add my tests to an OrderedTest, I get the above exception. My ChromeDriver.exe file is in bin/Debug folder.

I understand that paths for TestMethod execution and OrderedTest execution are not same, to resolve that I have tried adding [DeploymentItem(chromedrive.exe)] attribute before my Test Class.

Please help me resolve the issue.

Thanks in advance!

Regards,

Aman Shukla

解决方案

Hi shukla1292,

Which edition of Visual Studio do you use?

Did you add unit test to your OrderedTest?

I test it with unit test, and I can repro your issue.

Please remove "chromedriver.exe" in your project, and specify the calling path of the that file in code, please refer to following code sample:

IWebDriver chromeDriver = new ChromeDriver("C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\VSTT\\Cross Browser Selenium Components");

After changed your code, please rebuild your solution, and rerun the test method. Then, run your OrderedTest. This works fine in my side.

Regards,

Judyzh


这篇关于OpenQA.Selenium.DriverServiceNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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