打开一个新的色度驱动程序对象时,我将收到以下错误。测试成功运行,但是这个错误出现在我们的UnitTest输出中,是不可取的。我想要么解决错误,要么隐藏,如果可能的话。
我认为必须提到的是,只有在从Windows终端运行脚本时,才会显示此输出,而不是在Python控制台运行时。
[0406/170246.792:ERROR:child_thread_impl.cc(762)] Request for unknown Channel-associated interface: ui::mojom::GpuMainchromedriver_test.py:
from selenium import webdriver
webdriver.Chrome()我试过了
service_args=["--silent", "--log-level=0", --"disable-extensions", --"log-path=/PATH/TO/LOGS"]此外:
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')我还尝试将输出重定向到NUL。
$ python chromedriver_test.py > NUL
Windows 7 Chromedriver=2.29 Webdriver=3.3.1
发布于 2017-04-07 17:32:00
试试--disable-gpu开关。Chrome在初始化GPU时似乎有问题。在我的Arch Linux上,Chromium (57.0.2987.110版)和禁用GPU也有同样的问题--一切都很好。
发布于 2017-04-10 17:05:05
这是Chrome的一个bug
也许你应该使用另一个浏览器或其他版本。
在这里见更多:
Strange error in selenium after upgrading to chromedriver 2.28 needed for chrome 57
发布于 2017-04-12 12:08:00
这是我的密码。Itz工作得很好:
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)https://stackoverflow.com/questions/43266033
复制相似问题