Selenium 3.0 using firefox

 Selenium 3.0 using firefox

I am testing Xiaobai, but I also want to learn automation. The first contact is selenium, and I will only write the simplest examples. In the morning firefox was automatically updated, running selenium reported an error, the version does not match, go to the selenium official website and see that selenium  3.0.0-beta2  is out, what the hell is this, since it has been updated, download it and use it.

Once an error occurs, the path of the driver needs to be re-specified, and firefox cannot be used directly. How to solve it?

1. Go to Github to download geckodriver, download it according to your own system, Mac, Windows, Linux are available

2. The path to gecko needs to be specified in the code

System.setProperty("webdriver.gecko.driver","firepath");

WebDriver driver=new FirefoxDriver();

"webdriver.gecko.driver" This is the default way of writing, similar to specifying chrome

"firepath" is the actual path where we place gecko after downloading and decompressing. After setting the path, open firefox and you can use it.

One thing to mention, after running the code, I want the browser to close the window. I may have written driver.close();, but this sentence is invalid after testing. It is recommended to use driver.quit(); instead.

Personal feeling, after all, it is a beta version, there are quite a lot of problems, or wait until it is mature and then try selenium3.

prefer:http://www.jianshu.com/p/4b62475481dd

 

=

=

=

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326566671&siteId=291194637