Skip to content

[🐛 Bug]: Selenium chromedriver --ignore-certificate-errors not working as expected #2318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mahadi087 opened this issue May 26, 2025 · 4 comments
Labels
bug Something isn't working needs-triaging

Comments

@mahadi087
Copy link

What happened?

Hello, I am using 'selenium-java', version: '4.32.0'

In my test code i am passing chromedriver argument --ignore-certificate-errors. But my tests are still blocked by following security confirmation in the browser:

The information you're about to submit is not secure. Because this form is being submitted using a connection that's not secure, your information will be visible to others.

`public class IgnoreSSLErrorsExampleTest {
@test
public void testWithSSLIgnored() {
// Set path to ChromeDriver
System.setProperty("webdriver.chrome.driver",
System.getProperty("user.dir") + "\driver\chromedriver.exe");

// Configure Chrome to ignore SSL certificate errors
ChromeOptions options = new ChromeOptions();
options.addArguments("--ignore-certificate-errors");
options.setAcceptInsecureCerts(true);

// Initialize WebDriver
WebDriver driver = new ChromeDriver(options);

try {
    driver.get("http://******/login");
    Thread.sleep(2000);

    // Enter credentials and login
    driver.findElement(By.cssSelector("#Username")).sendKeys("custserv_prod_auto");
    driver.findElement(By.cssSelector("#Password")).sendKeys("C3y5Hd@f");
    driver.findElement(By.cssSelector(".btn-primary")).click();

    Thread.sleep(2000);

    // Handle OTP (method placeholder)
    passOTPToken();

    // Click trust browser button
    driver.findElement(By.xpath("//button[@id='accept-trust-browser-btn']")).click();
    Thread.sleep(2000);

    // Print the title of the page
    System.out.println("Page title is: " + driver.getTitle());

} catch (InterruptedException e) {
    throw new RuntimeException(e);
} finally {
    driver.quit();
}

}

private void passOTPToken() {
// TODO: Implement OTP logic
}
}`

Build info: version: '4.20.0', revision: '866c76ca80' System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.12' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [e25ff1943560b0b1ba8ccb70906d8c83, findElement {using=css selector, value=.verifyotp-number:nth-child(1)}] Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 136.0.7103.114, chrome: {chromedriverVersion: 136.0.7103.92 (cb81a4cc5087..., userDataDir: C:\Users\mhasan\AppData\Loc...}, fedcm:accounts: true, goog :chromeOptions: {debuggerAddress: localhost:56267}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:56267/devtoo..., se:cdpVersion: 136.0.7103.114, setWind owRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true} Session ID: e25ff1943560b0b1ba8ccb70906d8c83 [INFO] [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

What browsers and operating systems are you seeing the problem on?

Image

@mahadi087 mahadi087 added bug Something isn't working needs-triaging labels May 26, 2025
Copy link
Contributor

@mahadi087, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented May 26, 2025

This is not related to certificates. You are submitting a form on a site through http instead of https, that is why Chrome complains.

driver.get("http://******/login");

@diemol diemol closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2025
@mahadi087
Copy link
Author

@diemol Thanks for your feedback. Yes we have to pass it as http, As this is a special arrangement for with subdomain url for our product, ex: http://prod1.abcd.com/login

And in order to avoid browser security complain we are already passing following chrome browser arguments:

-> addArguments("--ignore-certificate-errors");

-> setAcceptInsecureCerts(true);

But this arguments are not taking into consideration to avoid the browser security error. Would you please re-check, thanks in advnced.

@diemol
Copy link
Member

diemol commented May 26, 2025

http uses no certificates, so using those flags won't make any difference. You need to research if there is a flag in Chrome to deactivate that message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triaging
Projects
None yet
Development

No branches or pull requests

2 participants