LoginSignup
4
3

More than 5 years have passed since last update.

selenium-webdriver@2.46.1の致命的なバグをダウングレードで先送りにした話

Last updated at Posted at 2015-08-11

最新版の selenium-webdriver@2.46.1 ですが、現在致命的なバグがあります。

問題

例えば、以下のサンプルコードは動作しますが:

var webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder()
  .forBrowser('firefox')
  .build();

// example.com に遷移し、"More information..." リンクをクリックする
driver.get('http://example.com');
driver
  .findElement(webdriver.By.linkText('More information...'))
  .then(function(el) { return el.click(); })
;

以下のコードは、"Scheduled tasks" は出力されますが、最初の example.com への遷移も起こらず、終了することもありません:

var webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder()
  .forBrowser('firefox')
  .build();

driver.get('http://example.com');
setTimeout(function() {
  driver
    .findElement(webdriver.By.linkText('More information...'))
    .then(function(el) { return el.click(); })
  ;
  console.log('Scheduled tasks');
}, 1);

また、mocha テストコードとして定義した場合は、初めのサンプルのように書いても動きません。

原因

この原因は、以下の Issue です:

Problem is the flow gets confused and deadlocks itself when a command is scheduled asynchronously when there's a dependency on the running task.

タスクが非同期に登録され、そのタスクの(おそらくはフローの制御が)実行中のタスクに依存しているとバグるとのことです。(だいぶ適当訳)

「実行中のタスクに依存」という条件は、詳細は省略してしまいますが、普通にテスト的なのを書くと、この条件に合致すると思います。

10/19に上記が解決された模様

詳細は未確認です。

対応(雑)

解決法なのですが、自分は selenium-webdriver@2.44.0 へダウングレードしたらこの問題はなくなりました。

ダウングレードによる影響は未調査です。

ただ、仕事で結構な量を書いていますが、今のところ、少なくとも他の致命的な問題には遭遇していません。

対応(真?)

Protractor は中で最新版を使っており、どうしているのかなーと思ったのですが:

上記のような書き方でも対応できるようで、この辺で対応しているのかな?と思いました。

この点は憶測で、全く調べずに言っております。

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