Get page headers from a request

Parra

Новичок
Регистрация
27.03.2018
Сообщения
25
Благодарностей
3
Баллы
3
Hello,

I have a page that run many requests.
Some of them uses a token. It is in the header of the requests and need to get that token into a variable.
I can see that token in traffic monitor but I need it in runtime.

Is there is a way to do that ?

Thank you,
Marcello
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
406
Благодарностей
91
Баллы
28
Yes, before visiting the site on the browser run this-
instance.UseTrafficMonitoring = true;

C#:
var traffic = instance.ActiveTab.GetTraffic();
foreach(var t in traffic) {
    if (t.Url.Contains("the url that contains your headers")) {
        return t.Url;
        // it can also be t.RequestBody; etc.
    }
}
return "-";
Look in to UseTrafficMonitoring, there are many discussions about it.
 

Parra

Новичок
Регистрация
27.03.2018
Сообщения
25
Благодарностей
3
Баллы
3
Great
Worked fine
Thank you
 
  • Спасибо
Реакции: myndeswx

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)