LoginSignup
1
2

More than 5 years have passed since last update.

Postman Test Script で HTMLをDOM検査

Last updated at Posted at 2018-06-19
pm.test("FORMタグのaction属性確認", function () {
    // ライブラリ読み込み
    const cheerio = require('cheerio')

    // HTML読み込み
    const $ = cheerio.load(pm.response.text());

    // Consoleログに出してみる
    console.log($('form').attr('action'));

    // form.actionの値を確認
    pm.expect($('form').attr('action')).to.equal("/post/edit");
});

参考: https://www.getpostman.com/docs/v6/postman/scripts/postman_sandbox_api_reference

pm.expect のAPIについては、下記のドキュメントを参考に
http://www.chaijs.com/api/bdd/

1
2
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
1
2