-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
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