Вы находитесь на странице: 1из 7

1. Download the Selenium Client from: https://www.seleniumhq.

org/download/

2. Create a folder on your documents


3. Download the drivers (in this case we are going to use Chrome driver)
http://chromedriver.chromium.org/downloads
4. Open an IDE (in this case we are going to use Intellij)
5. Create a Maven Project
Add the Selenium client, The one that you just downloaded
6. Copy de dependencias from Maven Repository

https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/3.11.0

https://mvnrepository.com/artifact/org.testng/testng/6.8

Click on Import changes

7. Create a package
8. Create a java class

9. Perform an action for each element

10 Run the test and check results.


This is the code:

package TestSeleniumPackage; //Package

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;

public class TestSelenium { //Class

WebDriver driver; //Webdriver instance

@Test // annotation for TesNG


public void test(){ //Method

System.setProperty("webdriver.chrome.driver","C:\\Users\\52551\\Documents\\Sele
nium\\chromedriver_win32\\chromedriver.exe"); // In this case you should add the root
where is the Chrome driver located

driver = new ChromeDriver();


System.out.println("Browser started");
driver.get("http://www.google.com"); //The page that you wnat to open
}
}

Вам также может понравиться