selenium - 如何使用 selenium 中的 chrome 进行自动 wifi 强制门户登录?
问题描述
我正在尝试使用 selenium 自动化 wifi 强制门户登录。为此,我在无头模式下使用了 chrome 驱动程序,如下面的代码所示。
从 selenium 导入 webdriver 从 selenium.webdriver.chrome.options 导入选项导入操作系统
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--window-size=1920x1080")
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://www.google.com")
# capture the screen
driver.get_screenshot_as_file("capture.png")
driver.quit()
但是一些博客说在没有 --no-sandbox 的情况下运行无头模式可能会导致 chrome 出现问题。那是对的吗?
如果我将 chrome 与沙箱一起使用会怎样?
我将为不同的客户端使用脚本,因此对于不同的客户端,强制门户会有所不同。我只需要知道在沙盒的任何情况下,chrome 是否会崩溃?
解决方案
推荐阅读
- c++ - 我无法使用 FTGL(未找到 ft2build.h)
- reactjs - 如何在 Firebase 中使用 SetState 或函数
- abstract-syntax-tree - 为什么自定义 ESLint 规则的选择器在 AST 上失败?
- php - PHP SOAP 类转换如何工作以及如何获得一致的列表结果?
- angularjs - AngularJS 中具有切换功能的垂直 SideMenu
- macos - 使用 awk 的多个分隔符并跟踪 $0 作为 var 对不同的字段进行排序
- c++ - 在 boost 进程异步子进程中 run() 之后是否需要 wait()?
- python-3.x - Pygments 中特殊的非句法突出显示
- ios - FirStorageUploadTask 的 Firebase EXC_BAD_ACCESS 错误
- c# - 我正在使用事件气泡日试点调度程序..单击事件时如何显示事件详细信息?