wethreetrees
wethreetrees

Reputation: 93

Python: selenium-chromedriver error on new browser object

I am receiving the below error upon opening a new chromedriver object. The tests run successfully, but this error shows up in our UnitTest output and is undesirable. I would like to either resolve the error or hide it, if possible.

I feel it is important to mention that this output only shows up when running the script from the Windows terminal, not when run from the Python Console.

[0406/170246.792:ERROR:child_thread_impl.cc(762)] Request for unknown Channel-associated interface: ui::mojom::GpuMain

chromedriver_test.py:

from selenium import webdriver

webdriver.Chrome()

I have tried

service_args=["--silent", "--log-level=0", --"disable-extensions", --"log-path=/PATH/TO/LOGS"]

also:

sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')

I have also tried redirecting the output to NUL

$ python chromedriver_test.py > NUL

Windows 7 Chromedriver=2.29 Webdriver=3.3.1

Upvotes: 3

Views: 3064

Answers (3)

There is my code. Itz works fine:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

class MyLib(object):
    def __init__(self):
        chrome_options = Options()
        chrome_options.add_argument('--disable-gpu')
        self.driver = webdriver.Chrome(chrome_options=chrome_options)

Upvotes: 1

Statham
Statham

Reputation: 4118

This is a bug of Chrome

Maybe you should use another brower or another version.

See more here:

Strange error in selenium after upgrading to chromedriver 2.28 needed for chrome 57

Upvotes: 1

skolem
skolem

Reputation: 151

Try the --disable-gpu switch. Chrome seems to have a problem with initializing the GPU. I had the same issue with Chromium (Version 57.0.2987.110) on my Arch Linux and with disabling the GPU everything works fine again.

Upvotes: 7

Related Questions