In short, it is a library for automatically executing web applications and parsing HTML (web scraping). Libraries are available in multiple languages such as python, node.js, Java, and PHP, and can be easily implemented.
Introducing Java x Selenium, until "Start Chrome → Open Google Search".
language | Java( ver.11 ) |
build | Maven |
browser | Google Chrome |
IDE | IntelliJ |
Premise Java x Maven application environment has been built.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
Download chrome driver http://chromedriver.chromium.org/downloads
"Start Chrome → Open Google Search"
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class MainApplication {
public static void main(String[] args){
final String PATH = "* Chrome Driver path";
System.setProperty("webdriver.chrome.driver", PATH);
WebDriver driver = new ChromeDriver();
final String URL = "http://www.google.com";
//URL transition
driver.get(URL);
}
}
Run the application and if you see a Google search like below Success: clap:
Recommended Posts