Comments (3)
I've never used basic auth with a proxy, but maybe try
launch_arg => ['--proxy-server=http://user:[email protected]']
... or try setting the HTTP_PROXY variable before launching Chrome:
$ENV{HTTP_PROXY} = 'http://user:[email protected]';
$ENV{HTTPS_PROXY} = 'http://user:[email protected]';
my $mech = WWW::Mechanize::Chrome->new(
...
# launch_arg => []
);
from www-mechanize-chrome.
Thanks, but it didn’t work.
I managed to make authorization through:
launch_arg => ['--proxy-server=http://12.43.56.67:1234'],
...
$chrome->driver->send_packet('Fetch.enable' , 'handleAuthRequests' => JSON::true );
my $asdf = $chrome->add_listener('Fetch.requestPaused', sub {
my( $info ) = @_;
my $requestId = $info->{'params'}{'requestId'};
$chrome->driver->send_message('Fetch.continueRequest' , 'requestId' => $requestId);
});
my $asd = $chrome->add_listener('Fetch.authRequired', sub {
my( $info ) = @_;
my $requestId = $info->{'params'}{'requestId'};
print "Fetch auth\n";
my %auth = (
'requestId' => $requestId ,
"authChallengeResponse" => {"response" => "ProvideCredentials" , "username" => "my_user_name" , "password" => "my_password"});
my $a = $chrome->driver->send_message('Fetch.continueWithAuth' , %auth);
});
from www-mechanize-chrome.
@arahnale
I'm trying your code, and it should work from what I can tell, but the Fetch.authRequired just doesn't seem to trigger. It only triggers the Fetch.requestPaused. "Fetch pause" is all that is outputted with a proxy error in chromium. Any suggestions?
my $asd = $mechtwo->add_listener('Fetch.authRequired', sub {
my( $info ) = @_;
print "Fetch auth\n";
my $requestId = $info->{'params'}{'requestId'};
my %auth = (
'requestId' => $requestId ,
"authChallengeResponse" => {"response" => "ProvideCredentials" , "username" => "" , "password" => ""});
my $a = $mechtwo->target->send_message('Fetch.continueWithAuth' , %auth);
});
my $asdf = $mechtwo->add_listener('Fetch.requestPaused', sub {
my( $info ) = @_;
print "Fetch pause\n";
my $requestId = $info->{'params'}{'requestId'};
$mechtwo->target->send_message('Fetch.continueRequest' , 'requestId' => $requestId);
});
from www-mechanize-chrome.
Related Issues (20)
- "'Page.navigate' wasn't found" when calling `get` on a page that's already loaded
- Can't locate object method "port" via package "URI::_generic" at .../perl/5.28.1/WWW/Mechanize/Chrome.pm line 1033. HOT 5
- Add support for POST form submission HOT 2
- Chrome/Chromium v97 closes CDP websocket while setting up a new instance HOT 1
- Windows 11, Strawberry Perl 5.32 64 bit. Install fails HOT 2
- VERY slow on xpath getting TDs of a TR HOT 4
- Use of @_ in numeric eq (==) with signatured subroutine is experimental HOT 4
- Failing on Windows (Not directly a WWW::Mechanize::Chrome issue) HOT 1
- WWW::Mechanize::Chrome->new hangs when --remote-allow-origins= is not set HOT 3
- Could not find node with given id HOT 1
- Test freezes on Win10, strawberry 5.32.1 HOT 1
- Constructor param data_directory has no effect but it is present in the launch args
- Could not read websocket endpoint from Chrome output because of 10 lines limit in sub read_devtools_url HOT 1
- Running version 0.71 on Perl 5.36 produces a lot of warnings HOT 1
- html to pdf is not working
- Installing (testing) in Linux as root enters infinite loop HOT 2
- Installation freezes on Windows 10 with Strawbery Perl 5.38.0.1-64bit HOT 5
- Unable to install HOT 5
- Tests randomly hang HOT 4
- Attach to Chrome functionality fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from www-mechanize-chrome.