Any way to get headers off the page?

15 views
Skip to first unread message

Eugene Pazhitnov

unread,
Mar 11, 2023, 4:01:43 PM3/11/23
to Selenium Remote Driver
Hi guys!

#!/usr/bin/perl -w

use Selenium::Firefox;

$ENV{MOZ_HEADLESS} = 1;

my $driver = Selenium::Firefox->new;

my $res = $driver->get('https://www.xbox.com/ru-RU/games/store/pers/9PHQQVWWN1V0/0010');

#### How to get responce headers from the page there?

$driver->shutdown_binary;

//eugene

George Baugh

unread,
Mar 11, 2023, 5:26:12 PM3/11/23
to Selenium Remote Driver
This has never been supported by Selenium Webdriver, and last I checked there were no plans to do so.
You *can* intercept all the requests you send with something like browsermob-proxy (see Browsermob::Proxy) and grab the headers intercepted thereby.

If on the other hand you choose to use playwright, this is supported out of the box:
Request | Playwright

GSB

Eugene Pazhitnov

unread,
Mar 14, 2023, 11:17:39 AM3/14/23
to Selenium Remote Driver
Thanks a lot for your reply, George!

I solved my problem with python seleniumwire driver and used driver.request_interceptor for getting headers. I guessed there is something similar in Selenium::Firefox.

But I prefer perl so definitely I should give a chance to Playwright.

 

воскресенье, 12 марта 2023 г. в 01:26:12 UTC+3, George Baugh:
Reply all
Reply to author
Forward
0 new messages