3 jmeter 抓包手写脚本——在loadrunner测试网站注册用户请求返回You've reached this page incorrectly (probably a bad user session value)

目的:实现jmeter在webtours注册用户,每注册一个用户添加验证。前面的步骤都没问题,到提交注册信息这个请求了,返回的结果不对,我的请求如下:


POST http://192.168.1.34:1080/WebTours/login.pl


POST data:

username: mmmm

password: mm

passwordConfirm: mm

firstName:m

lastName: m

address1: m

address2: m

register.x: 58

register.y: 13


Cookie Data:

MSO=SID&1565420348&MSO_JSFormSubmit1&on&MSO_JSVerify&on&MSO_JSWPages&on&MSO_JSFormSubmit2&on&MSO_ServerErrorsProb&50&MSO_ServerLoadProb&50


Request Headers:

Origin: http://192.168.1.34:1080

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3

Referer: http://192.168.1.34:1080/WebTours/login.pl?username=&password=&getInfo=true

Connection: keep-alive

Accept-Language: zh-CN,zh;q=0.9

Accept-Encoding: gzip, deflate

Content-Length: 133

Content-Type: application/x-www-form-urlencoded


response返回的错误页面如下:

attachments-2019-08-auLX8D475d4e6daa50fc6.png

 但正常应该返回如下的界面:

attachments-2019-08-rQQfKJhM5d4e6dccb6da9.png

我用chrome F12抓到的包和我在jemter请求的包没有什么区别,cookie也做了关联,但不知道为什么返回结果不一样,chrome抓到的请求如下:

    1. Accept:
      text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
    2. Accept-Encoding:
      gzip, deflate
    3. Accept-Language:
      zh-CN,zh;q=0.9
    4. Cache-Control:
      max-age=0
    5. Connection:
      keep-alive
    6. Content-Length:
      114
    7. Content-Type:
      application/x-www-form-urlencoded
    8. Cookie:
      MSO=SID&1565420680&MSO_JSFormSubmit1&on&MSO_JSVerify&on&MSO_JSWPages&on&MSO_JSFormSubmit2&on&MSO_ServerErrorsProb&50&MSO_ServerLoadProb&50
    9. Host:
      192.168.1.34:1080
    10. Origin:
      http://192.168.1.34:1080
    11. Referer:
      http://192.168.1.34:1080/WebTours/login.pl?username=&password=&getInfo=true
    12. Upgrade-Insecure-Requests:
      1
    13. User-Agent:
      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
  1. Form Dataview sourceview URL encoded
    1. username:
      3233
    2. password:
      3
    3. passwordConfirm:
      3
    4. firstName:
      3
    5. lastName:
      3
    6. address1:
      3
    7. address2:
      3
    8. register.x:
      58
    9. register.y: 13




搞了挺久了没找到答案,要是有遇到并解决了的麻烦指导一下,谢谢了。。


**********************************************************************************

已经找到答案了,是因为发送的body数据格式有问题,我发送的body是chrome转换后的数据,实际上body数据格式应该为:

username=${username}&password=${password}&passwordConfirm=${password}&firstName=4&lastName=4&address1=4&address2=4&register.x=74&register.y=12


记录一下,希望你们不要像我一样自己给自己挖坑。


请先 登录 后评论

  • 0 关注
  • 0 收藏,727 浏览
  • 提出于 2019-08-10 15:15

相似问题

360网站安全检测平台