0
1

【Python】ウインドウの切り替え方法

Last updated at Posted at 2024-02-07

◆問題
新規ウインドウを立ち上げた際に、切り替え方法が分からず操作できなかった。

◆対処法
「driver.switch_to.window」を使用したらできた。

after.py
new_handles = driver.window_handles
driver.switch_to.window(new_handles[0]) # 1番目のウインドウ
driver.switch_to.window(new_handles[1]) # 2番目のウインドウ
...
driver.switch_to.window(new_handles[-1]) # 最後のウインドウ
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1