如何在 selenium 中同时打开多个 windows。 python

how to open multiple windows in selenium at the same time. python

我正在尝试使用 selenium 打开多个 windows 相同的 URL, 我用for循环打开多个windows:

for i in range(x):
    driver = web driver.Chrome(executable_path="path")
    driver.get('testing')

但问题是 for 循环等待每个元素打开和加载,并在完成网站自动化后打开下一个 window。我希望所有的windows同时打开并同时执行以缩短所需时间,提前谢谢。

尝试使用目前仅处于 Alpha 阶段的 Selenium 4 https://pypi.org/project/selenium/4.0.0.a7/

它提供以下用于打开新 windows 和选项卡的功能:

# Opens a new tab and switches to new tab
driver.switch_to.new_window('tab')

# Opens a new window and switches to new window
driver.switch_to.new_window('window')