All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sunnydsouza.testframework.layers.selenium.browser.ChromeProfile Maven / Gradle / Ivy

Go to download

Generic frameowrk with different standalone layers for reporting,logging,test execution and test data management.

There is a newer version: 3.1.2
Show newest version
package com.sunnydsouza.testframework.layers.selenium.browser;

import java.io.File;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;

public class ChromeProfile {
	

	    public static void main(String[] args) {
	        //System.setProperty("webdriver.chrome.driver", "./chromedriver.exe");
	        ChromeDriverService chSvc = new ChromeDriverService.Builder()
	                .usingDriverExecutable(new File("./chromedriver.exe")).usingAnyFreePort().build(); 
	        ChromeOptions chOption = new ChromeOptions();
	        /**
	         * "user-data-dir = profilepath" --to open profile
	         * "--start-maximized" for maximize the browser 
	         */
	        chOption.addArguments("user-data-dir = Our Profile Path");
	        chOption.addArguments("--start-maximized");      
	        
	        
        		 /*ChromeOptions options = new ChromeOptions()
        		 options.addExtensions(new File("/path/to/extension.crx"))
        		 options.setBinary(new File("/path/to/chrome"));

        		 // For use with ChromeDriver:
        		 ChromeDriver driver = new ChromeDriver(options);

        		 // For use with RemoteWebDriver:
        		 RemoteWebDriver driver = new RemoteWebDriver(
        		     new URL("http://localhost:4444/wd/hub"),
        		     new ChromeOptions());*/
	        
	        
	        WebDriver driver = new ChromeDriver(chSvc, chOption);
	        driver.quit();
	    }
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy