0

It seems like my chromedriver is not updated by the below code:


import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import testone2.firstTest;

import java.io.*;

public class testLogin {

    protected WebDriver driver;
    private int seconds;

    public testLogin() {
        super();
    }

    @BeforeTest
    public void beforeTest() {
        //Download the web driver executable
        String chromeVersion = null;
        try {
            FileReader reader = new FileReader("chromeVersion.txt");
            BufferedReader br = new BufferedReader(reader);

            String line;

            while ((line = br.readLine()) != null) {
                chromeVersion = line.trim();
            }
            reader.close();
        } catch (IOException e) {
            Throwable ioException = new Throwable();
            ioException.printStackTrace();
        }

        WebDriverManager.chromedriver().version(chromeVersion).setup();
        boolean oldVersion = false;
        try {
            driver = new ChromeDriver();
        } catch (Exception e) {
            oldVersion = false;
            String err = e.getMessage();
            chromeVersion = err.split("version is")[1].split("with binary path")[0].trim();
            try {
                FileWriter writer = new FileWriter("chromeVersion.txt", true);
                writer.write(chromeVersion);
                writer.close();
            } catch (IOException er) {
            }
        }


        if (!oldVersion) {
            WebDriverManager.chromedriver().version(chromeVersion).setup();
            driver = new ChromeDriver();
        }

    }


    public void sleep(int seconds) {
        try {
            Thread.sleep(seconds * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}

Chrome is Version 88.0.4324.182 (Official Build) (64-bit) and WebDriverManager dependency is 4.2.2

This is returned in console: io.github.bonigarcia.wdm.WebDriverManagerException: io.github.bonigarcia.wdm.WebDriverManagerException: chromedriver 88.0.4324.150 for WIN64 not found in https://chromedriver.storage.googleapis.com/

Can anyone point out if its the code to read version of chromedriver at fault? What is the problem here? Thanks

user56979
  • 59
  • 1
  • 8

1 Answers1

0

Solved by setting chromeversion.txt to 88.0.4324.96

user56979
  • 59
  • 1
  • 8