1

I am using chrome driver version 2.35 in 2023, Why old chromedriver version? That's because my project using Chrome Extension Framework (CEF) project. enter image description here

  1. Using maven project

  2. IDE --> Intellij 2022.1.3 my pom.xml file:

     <dependencies>
       <dependency>
             <groupId>org.seleniumhq.selenium</groupId>
             <artifactId>selenium-java</artifactId>
             <version>4.7.2</version>
         </dependency>
         <dependency>
             <groupId>io.cucumber</groupId>
             <artifactId>cucumber-java</artifactId>
             <version>7.10.1</version>
         </dependency>
         <dependency>
             <groupId>io.cucumber</groupId>
             <artifactId>cucumber-junit</artifactId>
             <version>7.10.1</version>
         </dependency>
    

3.My code :

 public static ChromeDriver driver;
    public static WebDriverWait wait;
    public static JavascriptExecutor jse;
    public static Actions builder;
    public static Action test;

    public static void main(String[] args) throws InterruptedException , Throwable {
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setBinary("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
        chromeOptions.setExperimentalOption("debuggerAddress", "localhost:8003");
        driver = new ChromeDriver(chromeOptions);
        builder = new Actions(driver);

 WebElement fromElement = driver.findElement(By.xpath("//img[@class='rounded-circle' and ./following-sibling::p[text()='Pendidikan']]"));
        WebElement fromElementPensiun = driver.findElement(By.xpath("//img[@class='rounded-circle' and ./following-sibling::p[text()='Pensiun']]"));
        WebElement fromElement2 = driver.findElement(By.xpath("//*[@id='bag2']/div[3]"));
        WebElement toElement = driver.findElement(By.xpath("//div[@id='bag1']"));
        Action dragAndDrop = builder.clickAndHold(fromElementPensiun)
                .moveToElement(toElement)
                .release(toElement)
                .build();
        Thread.sleep(2000);
        dragAndDrop.perform();
        Thread.sleep(2000);

1 Answer 1

0

Because our chromedriver.exe with version 2.35, so we need to downgrade the selenium - java also. So, finally I using selenium-java version 3.141.59 :

  <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
   </dependency>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.