来自“入门”的Dalekjs Amazon示例与Chrome和PhantomJS无法合作

时间:2015-10-14 17:22:43

标签: javascript google-chrome automated-tests ui-testing dalekjs

当它在Chrome中运行时,我会得到FOUND: [object Object]文字断言。

当它在PhantomJS中运行时,我得到FOUND:(空白)。

Running tests
Running Browser: PhantomJS
OS: mac 10.10 (Yosemite) 32bit
Browser Version: 1.9.8

RUNNING TEST - "Amazon does its thing"
▶ OPEN http://www.amazon.com/
▶ TYPE #twotabsearchtextbox
▶ CLICK .nav-submit-input
▶ WAITFORELEMENT 
✘ TEXT
0 EXPECTED: The Blues Brothers
0 FOUND: 
✘ TEST - "Amazon does its thing" FAILED

 0/1 assertions passed. Elapsed Time: 58.91 sec 

我的测试:

module.exports = {
  'Amazon does its thing': function (test) {
    test
     .open('http://www.amazon.com/')
     .type('#twotabsearchtextbox', 'Blues Brothers VHS')
     .click('.nav-submit-input')
     .waitForElement('#result_0')
     .assert.text('#result_0 .newaps a span').is('The Blues Brothers')
     .done();
  }
};

我正在使用OS X Yosemite 10.10.5。

Chrome版本:46.0​​.2490.71(64位)

Dalek版本:

DalekJS CLI工具版本:0.0.5 DalekJS本地安装:0.0.9

1 个答案:

答案 0 :(得分:0)

似乎亚马逊已经将他们的DOM,分别是提交按钮类.nav-submit-input更改为.nav-input,以及结果页面的结构。因此,您还必须将#result_0 .newaps a span更改为#result_0 .s-access-title,然后再次使用。