Install Selenium server 3.0.1 + Chrome WebDriver + Eclipse Neon.1 + JDK 8u111 on Windows 7

Trabla: Install Selenium server 3.0.1 + Chrome WebDriver + Eclipse Neon.1 + JDK 8u111  on Windows 7


Install Selenium server 3.0.1 + Chrome WebDriver + Eclipse Neon.1 + JDK 8u111  on Windows 7


Solving:



Watch on YouTube


1. Download links used in tutorial:
1. Selenium - http://www.seleniumhq.org/
2. Chrome WebDriver - http://chromedriver.storage.googleapis.com/index.html?path=2.25/
3. Eclipse - https://www.eclipse.org/downloads
4. JDK - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2. Source programming code used in tutorial:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;


public class ChromeDriverTest {

    public static WebDriver getChromeWebDriver(){


        System.setProperty(
                "webdriver.chrome.driver", 
                // C:\selenium\driver\chromedriver.exe
                "/selenium/driver/chromedriver.exe"
        );
        
        ChromeOptions options = new ChromeOptions();
        options.addArguments("window-size=1024,768");
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        capabilities.setCapability(ChromeOptions.CAPABILITY, options);
        
        WebDriver driver = new ChromeDriver(capabilities);
        
        return driver;
    }
    
    
    public static void main(String[] args) {  
    
        
        WebDriver chrome = ChromeDriverTest.getChromeWebDriver();
        
        
        String url = "https://google.com";
        
        chrome.get(url); 
        
        System.out.println("Page title is: " + chrome.getTitle());
        
    }
    
    
}

No comments:

Post a Comment