JBrowserDriver not able to create Temp file

14 views Asked by At

I am running the following java code:

    import com.machinepublishers.jbrowserdriver.JBrowserDriver;
    import com.machinepublishers.jbrowserdriver.Settings;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;


    public class file {
    public static void main(String[] args) {
        // Set up jBrowserDriver
        Settings settings = Settings.builder()
                .headless(false) // Set headless mode to true
                .build();
        WebDriver driver = new JBrowserDriver(settings);

        try {
            // Open the website
            driver.get("https:testurl");

            // Find username and password fields using HTML ids
            WebElement usernameField = driver.findElement(By.id("test-username"));
            WebElement passwordField = driver.findElement(By.id("test-password"));

            // Fill in username and password
            usernameField.sendKeys("test-username");
            passwordField.sendKeys("test-password");

            // Find and click on the submit button
            WebElement submitButton = driver.findElement(By.id("submit"));
            submitButton.click();

            // Wait for a few seconds to see the result before closing the browser
            Thread.sleep(5000); // 5 seconds

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            // Quit the browser
            //driver.quit();
        }
        }
       }


No errors are shown but after compiling, this error is returned -

Exception in thread "main" org.openqa.selenium.WebDriverException: C:\Users\X\AppData\Local\Temp\jbd_tmp_4446403676842243611 Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: '000', ip: '00:00:00', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '22' Driver info: driver.version: JBrowserDriver at com.machinepublishers.jbrowserdriver.Util.handleException(Util.java:139) at com.machinepublishers.jbrowserdriver.JBrowserDriver.(JBrowserDriver.java:307) at file.main(file.java:14) Caused by: java.nio.file.AccessDeniedException: C:\Users\X\AppData\Local\Temp\jbd_tmp_4446403676842243611 at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:527) at java.base/java.nio.file.Files.createDirectory(Files.java:699) at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:134) at java.base/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:171) at java.base/java.nio.file.Files.createTempDirectory(Files.java:1017) at com.machinepublishers.jbrowserdriver.JBrowserDriver.(JBrowserDriver.java:305) ... 1 more

I have tried to manually route it to create a temp directory in a specified folder but it didn't work.

0

There are 0 answers