我可以在不使用chromedriver.exe的情况下将Selenium(webdriver)用于Chrome吗? [英] Can I use Selenium (webdriver) for Chrome without using chromedriver.exe?

查看:90
本文介绍了我可以在不使用chromedriver.exe的情况下将Selenium(webdriver)用于Chrome吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试以将硒纳入测试的方式来研究硒.我已阅读并观看了一些教程,它基本上需要使用设置为webdriver.chrome.driver属性的chromedriver.exe.但是,我们的公司政策限制我们使用/执行exe文件.结果,当我尝试Selenium chrome的代码时,收到一个错误,表明试图执行的exe文件未经授权.

I've been trying to study Selenium in ways we can incorporate it in our testing. I've read and watched some tutorial and it basically needs to use chromedriver.exe set as webdriver.chrome.driver property. However, our company policies restrict us from using/executing exe files. As a result, when I try my code for Selenium chrome, I get an error that the exe trying to execute is unauthorize.

所以我的问题是,有什么方法可以不用Schrome来使用Selenium,而不必使用chromedriver.exe?如果您知道文档,turorial甚至是YouTube指南的链接,请告诉我.谢谢!

So my question is that, is there any way I can use Selenium for chrome without having to use chromedriver.exe? If you know a link for a documentation, turorial or even a youtube guide, please let me know. Thanks!

推荐答案

我相信如果不使用chromedriver.exe,就无法在Selenium中使用chrome浏览器.同样适用于Internet Explorer.

I believe it is not possible to use chrome browser in Selenium without using chromedriver.exe. The same applies to Internet Explorer as well.

但是,如果确实禁止使用.exe文件,那么在Firefox中执行测试脚本会有所帮助.您需要做的就是添加以下代码:

However, if you are really prohibted from using .exe files, then executing your test scripts in Firefox will be helpful. All you need to do is to add the below code:

driver = new FirefoxDriver();

对于Firefox,无需引用任何.exe文件.希望这会有所帮助!

No need to refer any .exe files when it comes to Firefox. Hope this helps!

更新:在Selenium 3之后,甚至Firefox也需要geckodriver.

UPDATE: After Selenium 3 even Firefox needs geckodriver.

这篇关于我可以在不使用chromedriver.exe的情况下将Selenium(webdriver)用于Chrome吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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