简体   繁体   English

Firefox硒驱动程序

[英]Firefox driver for selenium

where to download the firefox driver for selenium? 在哪里可以下载Firefox的硒驱动程序?

I only find this, and herer is not the driver file for download https://code.google.com/p/selenium/wiki/FirefoxDriver 我只找到这个,而herer并不是下载https://code.google.com/p/selenium/wiki/FirefoxDriver的驱动程序文件

NOTE: I already have Selenium Webdriver IDE for Firefox but the script aks me to find firefox driver Can I use firefox in for webdriver in C# or its only capable for java? 注意:我已经有用于Firefox的Selenium Webdriver IDE,但是该脚本要求我查找firefox驱动程序。我可以在C#中将firefox用于webdriver还是仅适用于Java?

The best approach for C# projects is to install the WebDriver NuGet, because if there are any updates it will be notified. C#项目的最佳方法是安装WebDriver NuGet,因为如果有任何更新,它将被通知。 Just install NuGet Manager and search for WebDriver. 只需安装NuGet Manager并搜索WebDriver。

After that just use the following code: 之后,只需使用以下代码:

IWebDriver driverOne = new FirefoxDriver();
IWebDriver driverTwo = new InternetExlorerDriver("C:\\PathToMyIeDriverBinaries\");

The FirefoxDriver is included in the NuGet. FirefoxDriver包含在NuGet中。 However, you need to download manually the ChromeDriver from here: https://code.google.com/p/selenium/wiki/ChromeDriver 但是,您需要从以下位置手动下载ChromeDriver: https//code.google.com/p/selenium/wiki/ChromeDriver

You can find ten mins tutorial with images here: http://automatetheplanet.com/getting-started-webdriver-c-10-minutes/ 您可以在此处找到带有图像的十分钟教程: http : //automatetheplanet.com/getting-started-webdriver-c-10-minutes/

You just need to include/import driver to your project if you want to use firefox unlike for CHROME you need to store the jar file or Exe to a particular location and then then you just need to call it in your project 如果要使用firefox,而不是CHROME,则只需将驱动程序包含/导入到项目中,只需将jar文件或Exe存储到特定位置,然后在项目中调用即可

demo program 演示程序

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class Firefox {

         public void returnFirefoxBrowser(){
             WebDriver driver = new FirefoxDriver();
        }
    }

chrome

         File file = new File(
              "//Users//Documents//workspace//SELENIUM//chromedriver");
         System.setProperty("webdriver.chrome.driver",file.getAbsolutePath());
         WebDriver driver_chrome;
         driver_chrome = new ChromeDriver();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM