16
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Selenium】(Python)ハマった時のメモ

Last updated at Posted at 2019-07-02

#【1】画面外の文字がクリックできない。
###FormをSubmitしたいのだが、画面外にありクリックできない。

element = driver.find_element_by_xpath("//*[@id='update']")
element.click()

以下のようなエラーが出る。
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (392, 687)

###試したこと
####1.画面外へスクロール
Selenium利用時のトラブルシューティング方法[クリック編]
[seleniumにてButtonがクリックできない時の対処法]
(https://qiita.com/DNA1980/items/528ff6269986b262acdc)

画面上には表示されているが、スクロールしないと見えない状態の時ですので、スクロールしてクリックすればOKです。

と書かれているが、そもそもスクロールすらできなかった。

####2.submit メソッドを利用する
[python selenium で form を送るための 2パターン]
(http://blog.livedoor.jp/kmiwa_project/archives/1065433670.html)

element = driver.find_element_by_xpath("//*[@id='update']")
element.submit()

clickでなく、submitを使用するも同じエラー...

###解決策
Selenium-Debugging: Element is not clickable at point (X,Y)
execute_script()メソッドを使用することで解決した。

element = driver.find_element_by_xpath("//*[@id='update']")
driver.execute_script("arguments[0].click();", element)
16
14
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
16
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?