如何解决噩梦.click()问题不传播?

我已经减less了我与这个最小的例子与公共网站的问题。 点击“全部显示”button会触发更多的网站在每个浏览器中都可见,但不是噩梦:

var Nightmare = require('nightmare'); new Nightmare({timeout: 60000}) .viewport(1920, 10000) .goto('http://mtv.de/charts/5-hitlist-germany-top-100') .wait(10000) .screenshot('before.png') .click('div#content div.chart-container a.button.show-all') .wait(20000) .screenshot('after.png') .run(); 

我甚至试图用jQuery('...').trigger('click')触发点击jQuery('...').trigger('click') ,它可以在Chrome中工作,但不是在恶梦中.evaluate(...) 。 这里是运行上面的例子的debugging输出,没有什么特别的:

 nightmare queueing action "viewport" +0ms nightmare queueing action "goto" +3ms nightmare queueing action "wait" +0ms nightmare queueing action "screenshot" +0ms nightmare queueing action "click" +0ms nightmare queueing action "wait" +0ms nightmare queueing action "screenshot" +0ms nightmare run +0ms nightmare .setup() creating phantom instance with options {"timeout":60000,"interval":50,"weak":true,"loadImages":true,"ignoreSslErrors":true,"sslProtocol":"any","proxy":null,"proxyType":null,"proxyAuth":null,"cookiesFile":null,"webSecurity":true} +0ms nightmare .setup() phantom instance created +588ms nightmare .setup() phantom page created +4ms nightmare .viewport() to 1920 x 10000 +2ms nightmare .goto() url: http://mtv.de/charts/5-hitlist-germany-top-100 +2ms nightmare .goto() page loaded: success +3s nightmare .wait() for 10000ms +501ms nightmare .screenshot() saved to before.png +10s nightmare .click() on div#content div.chart-container a.button.show-all +2s nightmare .wait() for 20000ms +11ms nightmare .screenshot() saved to after.png +20s nightmare .teardownInstance() tearing down +2s 

事实certificate这是开发人员意识到的phantomjs的一个问题,但是却来自上游的webkit,使其无法修复。 当网站使用Modernizr(或类似的)来检查幻像提供的触摸支持时,就会发生这种情况。 当然,点击并不是触动事件队列,而噩梦的点击只会触发前者。

github问题与恶梦有所有链接学会更多。

我找不到为什么它不起作用,但你可以简单地加载url中的?expanded=true参数。

我用以下方法尝试CasperJS:

  • CasperJS的本地点击使用PhantomJS page.sendEvent
  • 合成PhantomJS点击 (类似于一个梦魇正在使用)和
  • 天真点击: document.querySelector(selector).click()

我注册了所有的事件,没有人提供任何线索。