0

I'm trying to load a plugin into Firefox using Selenide, but it's not working. I've tried everything I can think of, but I'm still getting an error.

I am using the Selenide library version 7.3.3 I am using the Firefox version 130.0 64 bit

import com.codeborne.selenide.Configuration;
import org.junit.jupiter.api.BeforeAll;
import io.github.bonigarcia.wdm.WebDriverManager;

import java.io.File;

/**
 * Base class for all tests.
 * Sets up the browser and loads the necessary extensions.
 */
public class BasicTest extends Methods {

    /**
     * Sets up the browser before each test.
     * Uses Firefox as the default browser.
     * Loads the CryptoPro extension for Firefox.
     */
    @BeforeAll
    public static void setBrowser() {
        // Set up the WebDriver for Firefox
        WebDriverManager.firefoxdriver().setup();
        Configuration.browser = "firefox";

        // Set the browser window size
        Configuration.browserSize = "1920x1080";

        // Path to the Firefox extension
        String firefoxAddonsPath = "src/main/resources/firefox_extension_latest.xpi";

        // Check if the extension file exists
        File addonFile = new File(firefoxAddonsPath);
        if (addonFile.exists()) {
            // Set the path to the extension if the file exists
            System.setProperty("selenide.firefox.addons", firefoxAddonsPath);
            System.out.println("Extension successfully loaded");
        } else {
            // Log an error message if the file is not found
            System.err.println("Extension file not found: " + firefoxAddonsPath);
            // Throw an exception if the extension is not found
            throw new RuntimeException("Firefox extension not found: " + firefoxAddonsPath);
        }

        // Enable fast value filling for fields
        Configuration.fastSetValue = true;
    }
}

I expect the extension to load successfully into the Firefox browser

0

Your Answer

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