4

WebdriverIO を使用してページ全体のスクリーンショットを撮ろうとしています。

WebdriverCSSを使用して WebdriverIO フローを強化するのが最善の方法であると読みました。WebdriverCSS はページ全体のスクリーンショットを自動的に作成しますか??

問題は、WebdriverCSS が機能しないことです。まだ対応していないからだと思いますwebdriverio@3.0.x

それを機能させる方法や、使用できる別のソリューションはありますか?

私のコード:(コールバックで未定義の値しか生成していません)

// Initialize WebdriverCSS for `client` instance
require('webdrivercss').init(driver, {
    // example options
    screenshotRoot: '../../screenshots',
    failedComparisonsRoot: '../../screenshots/diffs',
    misMatchTolerance: 0.05
});

// ...
// driver gets initialized and url opened
// ...

driver.webdrivercss('page', {
  name: 'body',
  elem: 'body'
}, function(err, res) {
  // here the values of err and res are always undefined
})
.saveScreenshot('../../screenshots/webdrivercsstest.png');
// the screenshot works, but it's not full page

!編集: これは Chromium の既知のバグであり、おそらく修正されません。詳しくはこちらのLINKをご覧ください。

4

4 に答える 4

-1

より高い div ID を渡して、そのスクリーンショットを撮ってみましたか

browser
    .init()
    .url("https://search.yahoo.com")
    .webdrivercss('startpage',[
            {
                name: 'fullpage',
                elem: '#purple-syc'
            }

編集:実行中にページ全体のスクリーンショットも表示できます

.saveScreenshot('./webdrivercss.png');

ヤフーホームページ

を使用.scroll('#myElement')してスクロールし、もう一度スクリーンショットを撮ります

于 2016-05-06T23:13:18.820 に答える