0

I am using Selenium in a Burp plugin but I can't load pages with the get method. Browsers open correctly, both Firefox and Chrome, but they don't load the page. Chrome address bar shows "data;.", while Firefox has no text in it. I am using the last driver available, Chrome 81.0.4044.183 and the driver for this exact version, while Firefox is 76.0.1 and I am using GeckoDriver 0.24 (since 0.25+ have a known bug) and it works with the last version of Firefox.

The code is the following

void runBrowserAutomatization(File fileDriver, String seleniumTrack, boolean isHeadless) {

        WebDriver driver;

        if (gui.usedBrowser().toLowerCase().contains("chrome")) {

            ChromeOptions options = new ChromeOptions();
            Proxy proxy = new Proxy();
            proxy.setHttpProxy("localhost:8080");
            proxy.setSslProxy("localhost:8080");

            options.setCapability(CapabilityType.PROXY, proxy);
            options.setHeadless(isHeadless);
            System.setProperty("webdriver.chrome.driver", fileDriver.getPath());

            driver = new ChromeDriver(options);

        } else if (gui.usedBrowser().toLowerCase().contains("firefox")) {

            FirefoxOptions options = new FirefoxOptions();
            Proxy proxy = new Proxy();
            proxy.setHttpProxy("localhost:8080");
            proxy.setSslProxy("localhost:8080");
            options.setCapability(CapabilityType.PROXY, proxy);
            options.setHeadless(isHeadless);
            System.setProperty("webdriver.gecko.driver", fileDriver.getPath());

            driver = new FirefoxDriver(options);

        } else {
            PrintMsg("No browser selected...");
            return;
        }

        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

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


        driver.quit();

    }

I may also think it is a Proxy misconfiguration, Burp certificate is installed in Firefox and Windows (where Chrome gets Certificate Authorities) but is not shown in the settings of the instance started by Selenium. Any help or suggestion is highly appreciated, thnaks.

Stefano
  • 327
  • 1
  • 4
  • 17
  • 'Burp certificate is installed in Firefox and Windows (where Chrome gets Certificate Authorities) but is not shown in the settings of the instance started by Selenium' It's because Selenium creates a temporary browser profile for each run. You need to load existing browser profile. See https://www.guru99.com/firefox-profile-selenium-webdriver.html and https://stackoverflow.com/questions/56169933/how-to-launch-chrome-extension-using-automation-robot-framework-etc/56180835#56180835 – pburgr May 14 '20 at 06:24
  • Hi, I tried both loading my default profile in firefox and setting the AcceptSslCerts to True in order to check if this was the issue but nothing changed. However, since also Chrome is not running properly, I assume this is not a Firefox problem. If you have other ideas please let me know, thanks – Stefano May 14 '20 at 09:51

0 Answers0