****************************************************************
Set<Cookie> cookies = driver.manage().getCookies();
Iterator<Cookie> itr = cookies.iterator();
while (itr.hasNext()){
Cookie c = itr.next();
System.out.println("Cookie Name: " + c.getName() + " --- " + "Cookie Domain: " + c.getDomain() + " --- " + "Cookie Value: " + c.getValue());
******************************************************************
the above code only returning 'session' cookie only. My web pages are 'https' , and the other cookie which I couldn't able to retrieve is (http only).
Note : I am not asking how to retrieve cookies,I am asking is there any way to retrieve cookies which are http only.
Can anyone help ? , feel free to ask me if you need more information.
public static WebDriver getWebDriver(String ...args) throws IOException {
String param = System.getProperty("driver","html");
String grid = System.getProperty("grid", "false");
//String platform = System.getProperty("platform","WINDOWS");
WebDriver driver = null;
DesiredCapabilities cap = null;
//ChromeDriverService service;
boolean useProfile = false;
for (int i=0; i < args.length; i++) {
if ("useProfile".equalsIgnoreCase(args[i])) {
useProfile = true;
}
}
log.debug("command line parm driver - {}", param);
if ("html".equals(param)) {
if ("true".equalsIgnoreCase(grid)) {
cap = DesiredCapabilities.htmlUnit();
cap.setBrowserName("html");
cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
}
driver = new HtmlUnitDriver();
} else if ("firefox".equals(param)) {
if ("true".equalsIgnoreCase(grid)) {
cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
cap.setPlatform(org.openqa.selenium.Platform.VISTA);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
}
FirefoxProfile profile = new FirefoxProfile(new File(System.getProperty("user.dir") + File.separator + "src"
+ File.separator + "test" + File.separator
+ "resources" + File.separator + "Selenium_Firefox_Profile"));
profile.setAssumeUntrustedCertificateIssuer(false);
driver = new FirefoxDriver(profile);
} else if ("ie".equals(param)) {
if ("true".equalsIgnoreCase(grid)) {
cap = DesiredCapabilities.internetExplorer();
cap.setBrowserName("internetExplorer");
cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
}
driver = new InternetExplorerDriver();
} else if ("chrome".equals(param)) {
System.setProperty("webdriver.chrome.driver",
System.getProperty("user.dir") + File.separator + "src"
+ File.separator + "test" + File.separator
+ "resources" + File.separator + "chromedriver");
System.out.println(System.getProperty("webdriver.chrome.driver"));
if ("true".equalsIgnoreCase(grid)) {
cap = DesiredCapabilities.chrome();
cap.setBrowserName("chrome");
cap.setCapability("chrome.switches", Arrays.asList("--user-data-dir=~/selemium/profile"));
cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
}
if (useProfile) {
cap = DesiredCapabilities.chrome();
cap.setCapability("chrome.switches", Arrays.asList("--user-data-dir=selenium_chrome_profile"));
driver = new ChromeDriver(cap);
}