问题描述
我见过几乎所有人都使用语句 WebDriver driver = new FirefoxDriver();
这里我们创建了一个 FirefoxDriver $ c的实例$ c>类型为
类的Webdriver
;
如果我直接创建一个FirefoxDriver实例 FirefoxDriver driver = new FirefoxDriver();
如果我说了很多话Webdriver是一个界面。我知道界面是什么以及它是如何工作的。我想知道 FirefoxDriver driver = new FirefoxDriver();
是否正确当我知道Firefox是我将在我的selenium脚本中使用的唯一浏览器时?
I have seen almost everybody using the statement WebDriver driver=new FirefoxDriver();
here we have created an instance of FirefoxDriver
class having type as Webdriver
; What if i directly create an instance of FirefoxDriver as FirefoxDriver driver = new FirefoxDriver();
I have gone through many discussion where it is said that Webdriver is an interface. I know what interface is and how it works. I want to know if FirefoxDriver driver = new FirefoxDriver();
is correct when i know that Firefox is the only browser i am gonna use in my selenium script?
推荐答案
正如您在问题中提到的那样知道 Firefox 是您将要使用的唯一浏览器您的selenium脚本然后使用以下代码行没有约束:
As you mentioned in your question that know that Firefox is the only browser you are gonna use in your selenium script then there is no constraint in using the following line of code :
FirefoxDriver driver = new FirefoxDriver();
在这里你可以找到关于
Here you can find a detailed discussion on What is the difference between ChromeDriver and WebDriver in selenium?
这篇关于这是正确的 - FirefoxDriver driver = new FirefoxDriver();?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!