5
3

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.

IEのSeleniumでID指定時のみNoSuchElementExceptionが出る時の応急処置

Last updated at Posted at 2015-04-21

Selenium WebDriverでIE11の自動テストを試したところ、idで指定した時だけエレメントが見つからないエラー(NoSuchElementException)が出てしまった。

他の指定方法(:cssや:name)だと問題なかったので、
もともとあったラッパーを下記のように変えてみたら動いた。

helpers.rb
def find(how, what)
  if how == :id
    how = :css
    what = "#" + what
  end
  @driver.find_element(how, what)
end

つまり
(:id, "xxx")を
(:css, "#xxx")
に変えてしまうという力技です。

根本的な解決方法あれば知りたいですが、とりあえずこれでやってます。

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?