使用Paw提取登录页面后面的URL的一部分

大卫

我是新手,但我认为Paw可以满足我的需求:

我需要在登录页面后面提取会话ID。我进入https://admin.booking.com,填写表单(登录并通过),后面的登录页面包含会话ID:https : //admin.booking.com/pc/index.htmlses = xxxxyyyyyzzzzz11112222233333

我想 :

1)将Paw的凭证作为我的请求的一部分,

2)获取上述项目(ses)作为响应,以便我可以使用Paw提供的php脚本扩展名,然后将该脚本称为“按需”。

这可能吗 ?如果是这样,我该怎么办?

谢谢你的帮助

米查·马扎赫里(Micha Mazaheri)

UPDATE *:我们添加了一个文档文章来描述该过程:通过Paw中的Web表单登录我们还详细介绍了处理CSRF令牌的过程。


Paw尚未准备好处理Web / HTML表单。不过,有一种正确的方法:如果您使用Chrome开发者工具检查表单,则会name从DOM / HTML中找到输入内容:

查找要在Paw表单中使用的HTML输入

In your case, you have the inputs: loginname, password, lang. Also, find the <form…> tag to see what's the action attribute. If there's no action attribute (like in your example), it means the target URL for your form is the current page's URL (https://admin.booking.com/ in your case). Also, make sure the method="POST" is also there in the <form…> tag, otherwise this method won't work.

Then jump into Paw and set:

  • URL (in your case https://admin.booking.com/)
  • method to POST
  • go to the Body tab and use "Form URL-Encoded + fill up the fields from your form

在Paw中模拟HTML表单

If all works, you'll see Paw show a redirection request, and if you go to the right-hand side panel under "Response" > "Headers", you should see a Location header with a value similar to the URL you initially mentioned (https://admin.booking.com/pc/index.html?ses=xxxxyyyyyzzzzz11112222233333). Hurray! You got your value into Paw!

Now that you have that, you can create in a new request (click on the + button at the bottom of the left-hand side list). And wherever you want to use this session token/ID, you can insert a dynamic value to retrieve that URL value. You have more infos here, in our docs, but I'll describe the steps here:

On whichever field you want to insert the token, right-click and pick Responses > Response Header.

在Paw中插入响应标头“动态值”

Make sure you pick the first request in the "Request" dropdown menu, and enter Location in the "Header" field:

在Paw中将标头动态值用于基于重定向的登录

You should see the value of the Location header of the previous response appear here.

Now what you want to do is to extract only the part you want (i.e. the value of the ses param in your case). For that you'll need that extension for Paw, so please install it now: https://luckymarmot.com/paw/extensions/RegExMatch

Copy the dynamic value you have just inserted (the blue token), and right-click on that field to insert a new dynamic value, and pick Extensions > RegExp match:

在Paw中选择一个RegExp匹配动态值以从先前的响应中提取字段

在“输入”字段中,粘贴先前复制的动态值。并使用RegExp字段编写一个正则表达式,该表达式将成功提取所需的URL部分(这对您而言适用ses=(.*))。

Extract a field from the header of a previous response in Paw

现在,您已经设置好了。您应该可以随时随地使用这个新的蓝色小标记,并自动从以前的表单中提取值。每当您再次发送初始请求并获得新令牌时,其他所有内容也会更新!:)

这是一个很长的指南,但是我希望这对您有帮助,对其他人也有帮助。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用jQuery通过URL中的哈希显示页面的一部分

单击按钮即可重新加载页面的一部分,使用新URL刷新整个页面

裁剪页面的一部分

更新 .php 页面的一部分

打印页面的一部分javascript

使用setInterval()刷新我的php页面的一部分

使用Laravel单击<a>元素仅更改页面的一部分?

安卓。Webview。使用Javascript显示页面的一部分

使用 Django 仅更新 HTML 页面的一部分

如何使用AnyEvent :: HTTP仅获取页面的一部分?

如何使用jQuery刷新页面的一部分

使用ajax重新加载页面的一部分

尽管使用了Selenium WebDriver,但只解析了页面的一部分

我需要使用Ajax动态更改页面的一部分

在“主页”之后提取URL的一部分

JavaScript 获取页面 URL 的一部分

php 使用 get 值的问题。适用于页面的一部分但不适用于另一部分

从div中将div中的文本提取/回显到页面的另一部分

使用sub提取路径的一部分

使用ffmpeg提取视频的一部分

使用php提取链接的一部分?

使用 openCV 提取图像的一部分

使用 JavaScript 从 URL 中提取路径的一部分的方法?

是否可以使ASP.NET页面使用不同的DOCTYPE呈现页面的一部分?

如何在aspx页面的一部分中打开HTML页面

更改html页面的一部分而不刷新整个页面

mmap是分配页面还是页面的一部分?

php:// output-仅输出页面的一部分而不是整个页面

重定向到页面的一部分,特别是页面顶部