Recommended Websites for learning websites
1. Official Document Http://www.seleniumhq.org/docs/
2.selenium Multithreading http://www.cnblogs.com/dingmy/p/3438084.html
Selenium Standalone Server
Build RC Environment
1. Download Selenium Standalone Server (http://www.seleniumhq.org/download/)
2. Download Chrome Drivers in the same directory as the Selenium-server-standalone.jar package (http://www.seleniumhq.org/download/)
Start hub
1. Open the terminal and switch to the directory where the Selenium-server-standalone is located
2. Execution Java-jar selenium-server-standalone-3.2.0.jar-role hub-maxsession 40-port 4444
3. Prompt for information when successful startup
Parameter description:
Maxsession Maximum number of sessions
Port Listener, default 4444, if the listening port is occupied by another program, the program cannot start successfully (customizable)
Start node
Open terminal, cut flower corresponding directory
1. Execution of Java-dwebdriver.chrome.driver=d:\chromedriver\chrodriver.exe-jar Selenium-server-standalone-3.2.0.jar-role Node-hub/http (own IP): 4444/grid/register-maxsession 20-browser "browser=chrome,maxinstances=20"-port 5555
Parameter description:
-dwebdriver.chrome.driver Chrome Drive
-hub Hub Server Address
-browser set Browser parameters, maximum number of processes
-maxsession maximum number of sessions, note that the maximum number of sessions on a branch node cannot exceed the maximum number of sessions defined on the hub server
-port listening port, default 5555
Call RC
Desiredcapabilities capabilities = Desiredcapabilities.chrome ();
Webdriver Driver = new remotewebdriver (new URL ("Http://192.168.199.146:4444/wd/hub"), capabilities);
To always selenium tools in your code, you need to add dependencies in your MAVEN configuration
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.2.0</version>
</dependency>
Note: The last choice is best to use the latest version, because it is compatible with the browser (once stepped on the pit).
Selenium-java Crawler Implementation