在任何平台上都可以在firefox上实现超时

时间:2016-05-20 10:35:58

标签: selenium selenium-webdriver intern

我的测试成功运行了chrome,但是firefox失败了。这是为什么?

>> PASS: chrome on any platform - sort column (21268ms)
>> 0/2 tests failed
>> 0/2 tests failed
>> FAIL: firefox on any platform - sort column (30015ms)
CancelError: Timeout reached on firefox on any platform - sort column
  at null._onTimeout  <node_modules/intern/lib/Test.js:132:20>
  at Timer.listOnTimeout  <timers.js:119:15>
  at Command.target.(anonymous function) [as getVisibleText]  <node_modules/intern/node_modules/leadfoot/Command.js:674:11>
  at EnhSearchTable.getTableData  </home/trex/Development/Siren/kibi-integration/tests/functional/support/page/EnhSearchTable.js:32:9>
  at Test.sort column [as test]  </home/trex/Development/Siren/kibi-integration/tests/functional/community/index.js:32:11>
  at <node_modules/intern/lib/Test.js:181:24>
  at <node_modules/intern/browser_modules/dojo/Promise.ts:393:15>
  at runCallbacks  <node_modules/intern/browser_modules/dojo/Promise.ts:11:11>
  at <node_modules/intern/browser_modules/dojo/Promise.ts:317:4>
  at run  <node_modules/intern/browser_modules/dojo/Promise.ts:237:7>
  at <node_modules/intern/browser_modules/dojo/nextTick.ts:44:3>
  at process._tickCallback  <node.js:355:11>
  at Command.then  <node_modules/intern/node_modules/leadfoot/Command.js:542:10>
  at Command  <node_modules/intern/node_modules/leadfoot/Command.js:566:15>
  at <node_modules/intern/lib/Test.js:206:37>
  at Promise.cancel  <node_modules/intern/browser_modules/dojo/Promise.ts:343:37>
  at null._onTimeout  <node_modules/intern/lib/Test.js:134:21>
  at Timer.listOnTimeout  <timers.js:119:15>
>> 1/2 tests failed
>> 1/2 tests failed

我的页面对象的一部分:

  return this.remote
    .setTimeout('implicit', 5000)
    .get(require.toUrl(kibiUrl))
    .sleep(5000)
    .findAllByLinkText('Dashboard')
    .click()
    .sleep(1000)
    .end()
    .findByXpath('//ul[@class="nav nav-tabs"]/li[' + tabNum + ']')
    .click()
    .sleep(10000)
    .end()
    .findByXpath('//span[@title="' + tableName + '"]/../../visualize//table/thead/tr/th[6]')
    .moveMouseTo()
    .sleep(1000)
    .findByXpath('./span/i')
    .click()
    .sleep(1000)
    .end()
    .findByXpath('//span[@title="' + tableName + '"]/../../visualize//table/tbody')
    .getVisibleText()
    .then(function (body) {
      return body;
    });

我的操作系统:

cat /proc/version
Linux version 4.2.0-36-generic (buildd@lgw01-42) (gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) ) #42-Ubuntu SMP Thu May 12 22:05:35 UTC 2016

我使用此软件包https://www.npmjs.com/package/selenium-standalone

中的Firefox 46.0.1和Selenium 2.53

1 个答案:

答案 0 :(得分:0)

我使用了setFindTimeout()方法,现在它可以正常工作。

 return this.remote
    .get(require.toUrl(kibiUrl))
    .setFindTimeout(5000)
    .findAllByLinkText('Dashboard')
    .click()
    .end()
    .findByXpath('//ul[@class="nav nav-tabs"]/li[' + tabNum + ']')
    .click()
    .end()
    .findByXpath('//span[@title="' + tableName + '"]/../../visualize//table/thead/tr/th[6]')
    .moveMouseTo()
    .findByXpath('./span/i')
    .click()
    .end()
    .findByXpath('//span[@title="' + tableName + '"]/../../visualize//table/tbody')
    .getVisibleText()
    .then(function (body) {
      return body;
    });