0% found this document useful (0 votes)
4 views1 page

Code Download

This Java program uses Selenium WebDriver to automate a Chrome browser. It sets up the ChromeDriver, maximizes the browser window, deletes all cookies, navigates to Google, and takes a screenshot of the page. The screenshot is saved to a specified location on the user's file system.

Uploaded by

amit ughade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Code Download

This Java program uses Selenium WebDriver to automate a Chrome browser. It sets up the ChromeDriver, maximizes the browser window, deletes all cookies, navigates to Google, and takes a screenshot of the page. The screenshot is saved to a specified location on the user's file system.

Uploaded by

amit ughade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package basics;

import java.io.File;
import java.io.IOException;

import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.apache.commons.io.FileUtils;

public class Miscelleanous {

public static void main(String[] args) throws IOException {


// TODO Auto-generated method stub

System.setProperty("webdriver.chrome.driver",
"C://work//chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();

// driver.manage().deleteCookieNamed("sessionKey");

//click on any link


//login page- verify login url

driver.get("http://google.com");

File src=
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src,new File("C:\\Users\\rahul\\
screenshot.png"));

You might also like