0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】画面をスクロールする方法

Last updated at Posted at 2024-02-07

◆問題
画面のスクロールができず、要素の取得やクリックができなかった。

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

after.py
# 最下部までスクロール
driver.execute_script('window.scrollTo(0, document.body.scrollHeight);')

# 最上部までスクロールする
driver.execute_script("window.scrollTo(0, 0)")

# X座標に0ピクセル、Y座標に500ピクセルスクロールする
driver.execute_script("window.scrollTo(0, 500)")
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?