Setup ChromeDriver with selenium Java - Code

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;


public class ChromeAutomationExample {

    public static void main(String[] args) {

        // Set the path to the ChromeDriver executable

        System.setProperty("webdriver.chrome.driver", "path/to/chromedriver.exe");

        

        // Initialize ChromeDriver

        WebDriver driver = new ChromeDriver();

        

        try {

            // Navigate to a website

            driver.get("https://www.example.com");

            

            // Perform actions - Add your code here to interact with the website

            

            // Close the browser

            driver.quit();

        } catch (Exception e) {

            e.printStackTrace();

        }

    }

}


0 تعليقات

إرسال تعليق

Post a Comment (0)