I am unable to load any page through Selenium if the Burp proxy is on, the code I run is the following
void runBrowserAutomatization(File fileDriver, String seleniumTrack, boolean isHeadless) {
this.fileDriver = fileDriver;
String filePath = this.fileDriver.getAbsolutePath();
WebDriver driver;
if (gui.usedBrowser().toLowerCase().contains("chrome")) {
System.setProperty("webdriver.chrome.driver", filePath);
Proxy p = new Proxy();
p.setHttpProxy(PROXY_SOCKET); // PROXY_SOCKET = "127.0.0.1:8080"
p.setSslProxy(PROXY_SOCKET); // PROXY_SOCKET = "127.0.0.1:8080"
ChromeOptions opt = new ChromeOptions();
opt.setCapability(CapabilityType.PROXY, p);
driver = new ChromeDriver(opt);
} else if (gui.usedBrowser().toLowerCase().contains("firefox")) {
System.setProperty("webdriver.gecko.driver", filePath);
Proxy p = new Proxy();
p.setHttpProxy(PROXY_SOCKET); // PROXY_SOCKET = "127.0.0.1:8080"
p.setSslProxy(PROXY_SOCKET); // PROXY_SOCKET = "127.0.0.1:8080"
FirefoxOptions opt = new FirefoxOptions();
opt.setCapability(CapabilityType.PROXY, p);
driver = new FirefoxDriver(opt);
} else {
PrintMsg("No browser selected...");
return;
}
driver.manage().timeouts().pageLoadTimeout(TIMEOUT_SEC, TimeUnit.SECONDS);
driver.manage().window().maximize();
WebElement currentElement = null;
try {
driver.get("https://www.ansa.it/");
} catch (Exception e) {
PrintMsg((e.getClass().getName()+ "\nError message: " + e.getMessage()));
driver.quit();
}
driver.quit();
}
The error shown in Google Chrome is the following
timeout: Timed out receiving message from renderer: -0.001
(Session info: chrome=83.0.4103.97)
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'MSI', ip: '192.168.1.108', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_251'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.97, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\Stefano\AppData\Lo...}, goog:chromeOptions: {debuggerAddress: localhost:50862}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(manual, http=127.0.0...., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: 2bc6869c6817e3dc3cbd6cb4866acc3b
And the Burp cmd prints this log
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 42031
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1591285080.490][SEVERE]: Timed out receiving message from renderer: 10.000
[1591285080.491][SEVERE]: Timed out receiving message from renderer: -0.001
[1591285080.493][SEVERE]: Timed out receiving message from renderer: -0.001
While in Firefox the exception message is the following
Timeout loading page after 10000ms
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'MSI', ip: '192.168.1.108', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_251'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 76.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20200507114007, moz:geckodriverVersion: 0.26.0, moz:headless: false, moz:processID: 3164, moz:profile: C:\Users\Stefano\AppData\Lo..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 10.0, proxy: Proxy(manual, http=127.0.0...., rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 0caec7ca-d654-445c-998a-1f41f058d533
And the Burp cmd is showing the following log
1591285235902 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Stefano\\AppData\\Local\\Temp\\rust_mozprofiledfeV0Z"
1591285236140 addons.webextension.doh-rollout@mozilla.org WARN Loading extension 'doh-rollout@mozilla.org': Reading manifest: Invalid extension permission: networkStatus
1591285236367 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1591285236367 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1591285236367 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1591285236367 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1591285237876 Marionette INFO Listening on port 50991
1591285237910 Marionette WARN TLS certificate errors will be ignored for this session
1591285237912 Marionette INFO Proxy settings initialised: {"proxyType":"manual","httpProxy":"127.0.0.1:8080","sslProxy":"127.0.0.1:8080"}
JavaScript warning: https://www.ansa.it/sito/js/jquery-1.10.2.min.js, line 2: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
JavaScript warning: https://www.ansa.it/sito/js/0130122946_js-head-pack.js, line 1: unreachable code after return statement
JavaScript error: https://optimized-by.4wnetwork.com/js/sdk.min.js, line 63: TypeError: a is undefined
JavaScript error: https://optimized-by.4wnetwork.com/js/sdk.min.js, line 63: TypeError: a is undefined
JavaScript error: https://optimized-by.4wnetwork.com/js/sdk.min.js, line 63: TypeError: a is undefined
JavaScript error: , line 0: NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
JavaScript error: , line 0: NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
JavaScript error: , line 0: NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
JavaScript error: , line 0: NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
1591285252948 Marionette INFO Stopped listening on port 50991
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
Note that without Proxy pages are loaded with no problem
I really need help so if you have any advice, fix or workaround please answer, thanks.