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?

More than 3 years have passed since last update.

SeleniumでElementNotInteractableExceptionが発生した時の対処法

Posted at

JavaのSeleniumでチェックボックスをクリック(チェック)しようとしたら、ElementNotInteractableExceptionが発生した。

元のコード
  WebDriver driver = new ChromeDriver(driverService, options);
  // 省略
  driver.findElement(By.id("checkbox")).click();
発生した例外
org.openqa.selenium.ElementNotInteractableException: element not interactable

同様の操作をJavaScriptで行なったら成功した。

修正後のコード
  JavascriptExecutor executor = (JavascriptExecutor) driver;
  executor.executeScript("arguments[0].click();", driver.findElement(By.id("checkbox")));

何故だw

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?