16 July 2024 Leave a comment QA
When automating tests using Selenium with ChromeDriver, you might encounter a yellow notification under the URL bar that says “Chrome is being controlled by automated test software.” This guide will show you how to disable this notification using different programming languages and methods.
Solution for Java
To start, if you are using Java, adding the argument disable-infobars
to your ChromeOptions can effectively disable this notification.
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);
This method is simple and has been proven to work effectively in many cases. However, be aware that using disable-infobars
might suppress other useful information in the future.
Solution for Python
If you are using Python, you can achieve the same effect by adding the disable-infobars
argument to your ChromeOptions as shown below:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--disable-infobars")
browser = webdriver.Chrome(executable_path='path_to_chromedriver', chrome_options=chrome_options)
Alternative Approaches
Another solution is to use the excludeSwitches
experimental option. This method is generally recommended to avoid suppressing other infobars:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
WebDriver driver = new ChromeDriver(options);
Using Collections.singletonList
instead of Arrays.asList
ensures that you are passing a single argument to excludeSwitches
, which is more efficient.
Additional Considerations
It’s important to note that disabling the infobar notification might suppress other useful information. Ensure that this change does not interfere with other testing functionalities in your project. For more detailed guidance, you can refer to our comprehensive documentation on running test batches.
Using Repeato for Automated Testing
For those looking for a more streamlined and efficient way to manage automated tests for iOS and Android applications, consider using Repeato. It is a no-code test automation tool that leverages computer vision and AI to create, run, and maintain automated tests quickly and easily. Repeato helps ensure high-quality assurance with minimal setup and usage complexity, making it an excellent choice for both novice and experienced testers.
For more information on how Repeato can enhance your testing process, visit our documentation and blog.