与chrome dri在自动脚本中共享屏幕的方法

2024-04-28 23:59:05 发布

您现在位置:Python中文网/ 问答频道 /正文

使用python3.7和最新的chrome驱动程序。 我试图使用googlemeet来共享我的屏幕,使用Selenium的chomedriver,但是我不断地得到错误“你的浏览器不能共享你的屏幕”,不管我给驱动程序的选项是什么。你知道吗

我试着禁用gpu和硬件加速,就像我在类似问题中看到的那样,但没有任何改变。你知道吗

options = webdriver.ChromeOptions()
options.add_argument("--incognito")
options.add_argument("--start-maximized")

browser = webdriver.Chrome(options=options)

我希望有一种方法可以自动与脚本共享我的屏幕。你知道吗


Tags: addgpu屏幕选项selenium错误驱动程序浏览器
1条回答
网友
1楼 · 发布于 2024-04-28 23:59:05

在chromedriver开发人员提交了一份bug报告之后,他们给出了一个解决方案。 https://bugs.chromium.org/p/chromedriver/issues/detail?id=2905

By johnchen:

Some Chrome features don't work properly in a test environment. For this particular case, you can work around by removing the switch that tells Chrome it's running a test. If you're using Python, you need to add:

opt = webdriver.ChromeOptions()
opt.add_experimental_option('excludeSwitches', ['test-type'])

In Java, you can use

ChromeOptions opt = new ChromeOptions();
opt.setExperimentalOption("excludeSwitches", new String[] { "test-type" });

相关问题 更多 >