LoginSignup
20
11

More than 5 years have passed since last update.

Seleniumで新規タブを開く

Last updated at Posted at 2017-12-05

クリックをして新規タブで開く(Macの場合のキーバインドと同様の指示を書く)

element.send_keys(:command, :enter)

新規の空タブを開いて用意して、そこに指定したURLを開く
selenium上で任意のjavascriptを実行するexecute_scriptメソッドを使用

driver.execute_script("window.open()")
new_window = driver.window_handles.last
driver.switch_to.window(new_window)
driver.get('新規タブで開きたいURL')
20
11
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
20
11