Python with Selenium issue: “Chrome is being controlled by automated test software”

+1 vote

I have a small Python app that records a webpage/ web animation with Selenium and FFmpeg. This Worked until yesterday but it seems that the "--disable-infobars" feature has been removed. How can I overcome this because otherwise I am forced to add padding to the top and record from the padding?

Below is the sample code:-

#!/usr/bin/env python3
from pyvirtualdisplay import Display
import os

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options

url = "http://foo.bar"

os.environ['DISPLAY'] = ':99'
display = Display(visible=0, size=(1920, 1080))
display.start()
display_port = os.environ['DISPLAY']

chrome_driver_path = "/usr/local/bin/chromedriver"
options = webdriver.ChromeOptions()
options.add_argument('--disable-gpu')
options.add_argument('--kiosk')
options.add_argument('--window-position=0,0')
options.add_argument('--disable-infobars');
options.add_argument('--window-size=1920,1080')

browser = webdriver.Chrome(executable_path=chrome_driver_path, chrome_options=options)
browser.get(url)

command = "/home/fidox/bin/ffmpeg -r 60 -t {} -video_size {}x{} -framerate 60 -f x11grab -i foo.mp4 f-an {}".format(10,1920,1080,display_port)
os.system(command) 

self.browser.quit()
display.stop()
Mar 26, 2018 in Selenium by Shubham
• 13,290 points
1,324 views

1 answer to this question.

0 votes

"disable-infobars" flag has been deprecated, but you can avoid this message by adding the following:

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
options.setExperimentalOption("excludeSwitches",Collections.singletonList("enable-automation"));    
WebDriver driver = new ChromeDriver(options);

This work for me and I hope works for you too.

answered Mar 26, 2018 by nsv999
• 5,090 points
But your piece of code is for Java. Can you provide a solution for Selenium Python Webdriver?

Related Questions In Selenium

+2 votes
1 answer

I want the console.log output from Chrome. I'm working with selenium on Python

So this is how you do it ...READ MORE

answered May 3, 2018 in Selenium by sniffy_god
• 780 points
10,021 views
0 votes
1 answer

How to handle notifications in Python with Selenium (Chrome WebDriver)

Below will help you: You can disable the ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
2,274 views
0 votes
2 answers

Python: Using an existing google chrome profile with selenium chrome web driver

The problem is with the string "C:\Users\Eric\Desktop\beeline.txt" Here, \U starts an ...READ MORE

answered May 23 in Selenium by shinio llahsra
2,708 views
0 votes
1 answer

How can I write test scripts in Selenium with python?

Hey Khushi, writing test scripts in Selenium ...READ MORE

answered May 9 in Selenium by Anvi
• 12,840 points
57 views
0 votes
1 answer

How can we use Selenium with Python?

First  Install Python based on the Operating ...READ MORE

answered May 7, 2018 in Selenium by Meci Matt
• 9,420 points
66 views
0 votes
1 answer
0 votes
1 answer

Disable notification" “Chrome is being controlled by automated test software” in ChromeDriver 2.36

"disable-infobars" flag has been deprecated, but you ...READ MORE

answered Mar 26, 2018 in Selenium by nsv999
• 5,090 points
1,508 views
0 votes
1 answer