Mac上的Selenium:网络驱动程序不显示窗口
我想在使用Selenium时看到Mac OS Monterey上的浏览器窗口(无头模式的对面)。
示例:
#!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.github.com")
input()
print(driver.title)
一切都按预期工作(包括打印标题)。 但是,浏览器窗口未显示。
我该怎么办才能查看浏览器窗口?
I would like to see the browser window on Mac Os Monterey when using Selenium (the opposite of the headless mode).
Example:
#!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.github.com")
input()
print(driver.title)
Everything works as expected (including that the title is printed).
However, the browser window does not show up.
What can I do to see the browser window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我花了一段时间才看到了这一点,但实际上窗口打开了,但是它没有在码头或应用程序切换器中显示,因此它很容易被忽略。但是,它确实出现在LaunchPad中(尽管尝试切换到它时似乎表现出奇怪的表现)。
特别是如果您使用多个屏幕,请确保“到处查看”。
It took me a while to see this, but actually the window opens, but it does not show up in the dock or in the Application switcher, so it is very easy for it to go unnoticed. It does however show up in Launchpad (though it seems to behave strangely when trying to switch to it).
Especially if you are working with multiple screens, make sure to "look everywhere".