Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show custom message on chrome infobar using selenium chrome driver

I want to show custom message on the chrome infobar instead of "Chrome is being controlled by an automated test software". How is this possible using selenium?

like image 662
ashkaps Avatar asked Sep 05 '25 20:09

ashkaps


1 Answers

Unfortunately, there does not seem to be any way of having custom infobars in Chrome. However, there is usually more than one way to skin a cat. If you need a mechanism to give test meta-info to the tester (iteration #, variable values, test title, etc) that works for all browsers, then you can just change the title of the page, like this:

String javascript = "document.getElementsByTagName('title')[0].textContent = 'yourtext';";
((JavascriptExecutor) Common.driver).executeScript(javascript);

Note that while you're still in Java, you can modify "yourtext" any way you want. Just make sure that you're not checking the title of the web page as part of your selenium test.

like image 187
Tihamer Avatar answered Sep 09 '25 00:09

Tihamer