3 July 2024 Leave a comment QA
When running automated tests with Chrome, you might have encountered the infobar stating “Chrome is being controlled by automated test software.” This can be a distraction and may affect your testing environment. Unfortunately, the option to disable this infobar using the --disable-infobars
flag was removed in recent versions of Chrome. However, there are alternative methods to achieve this.
Understanding the Change
The Chromium team removed the --disable-infobars
flag because it was no longer needed for performance testing infrastructure and could be misused for malicious purposes. As a result, you can no longer use this flag in Chrome versions starting from 65.0.3325.146. Below, we will explore the recommended solutions to address this issue.
Alternative Solutions
Using Experimental Options in Java
If you are using Java, you can use the following code snippet to disable the infobar:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com");
This method sets an experimental option to exclude the “enable-automation” switch, which effectively hides the infobar.
Other Languages
For other programming languages like Python, Ruby, JavaScript, and frameworks like Protractor, you can refer to the detailed guide provided by Applitools. Here is the link to their comprehensive guide: Applitools Guide.
Additional Experimental Options
Another approach involves using additional experimental options:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
WebDriver driver = new ChromeDriver(options);
This method disables the automation extension and excludes the “enable-automation” switch, effectively hiding the infobar.
Conclusion
While the removal of the --disable-infobars
flag has made it more challenging to hide the infobar, the alternative solutions provided above should help you achieve the same result. By using experimental options, you can ensure a cleaner testing environment without the distraction of the infobar.
For those looking for a more streamlined and efficient way to manage automated testing, consider using Repeato. Repeato is a no-code test automation tool for iOS and Android that leverages computer vision and AI to create, run, and maintain automated tests effortlessly. Its simplicity, speed, and efficiency make it an excellent choice for quality assurance tasks.
For more information, visit our Getting Started guide.