The Java test environment is simpler to build than Python, as long as the relevant jar package is imported.
1. Install Java
Download the latest Java installer from the official website and double-click Install (java1.8)
2. Download the Java version of the Selenium jar package (including client and server-side jar packages)
Client and service side
3. Import Jar Package
Create a new project in Eclipse, then right-click the project and select "Build Path"-"Configure Build Path"
4. Import Jar Package
5, after the import can create test class for testing, the following is a basic open web page operation:
Package Seleniumtest;import Java.util.concurrent.timeunit;import Org.openqa.selenium.webdriver;import Org.openqa.selenium.firefox.firefoxdriver;public class Firstselenium {public static void main (String args[]) { System.setproperty ("Webdriver.firefox.bin", "D:\\Program Files\\mozilla firefox\\firefox.exe"); Webdriver Driver = new Firefoxdriver ();d river.manage (). window (). Maximize ();d river.manage (). Timeouts (). Implicitlywait (8, Timeunit.seconds);d river.get ("http://www.baidu.com");d river.quit ();}}
Web Automation Test (Java)---environment building