wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.9k stars 254 forks source link

Using with undetected Chromedriver #349

Closed petzi75 closed 3 years ago

petzi75 commented 3 years ago

it works, but I get thousends of DEBUG loggings if I import the v2 over selenium-wire package Direct from uc, where I used before, there are no debug loggs How can I disable this please? I couldn`t find any information about...

HMaker commented 3 years ago

What are the logs?

petzi75 commented 3 years ago

I`ve added this command now: logging.getLogger('seleniumwire').level = logging.INFO reduces the amount a little bit - so no DEBUGS with 127.0...... are listening anymore.

but also hundreds per each second like this: 2021-07-19 21:44:55 DEBUG: Resizing header table to 65536 from 4096 2021-07-19 21:44:55 DEBUG: Decoded 2, consumed 1 bytes 2021-07-19 21:44:55 DEBUG: Decoded (b':method', b'POST'), consumed 1 2021-07-19 21:44:55 DEBUG: Decoded 2, consumed 1 bytes 2021-07-19 21:44:55 DEBUG: Decoded (b':method', b'GET'), consumed 1 2021-07-19 21:44:55 DEBUG: Decoded 1, consumed 1 bytes 2021-07-19 21:44:55 DEBUG: Decoded (b':method', b'GET'), consumed 1 2021-07-19 21:44:55 DEBUG: Adding (b'origin', b'https://www.google.com') to the header table, sensitive:False, huffman:True 2021-07-19 21:44:55 DEBUG: Encoding 5 with 7 bits 2021-07-19 21:44:55 DEBUG: Encoding 16 with 7 bits 2021-07-19 21:44:55 DEBUG: Adding (b'content-type', b'application/x-www-form-urlencoded') to the header table, sensitive:False, huffman:True 2021-07-19 21:44:55 DEBUG: Encoding 31 with 6 bits 2021-07-19 21:44:55 DEBUG: Encoding 24 with 7 bits 2021-07-19 21:44:55 DEBUG: Adding (b'sec-fetch-site', b'none') to the header table, sensitive:False, huffman:True 2021-07-19 21:44:55 DEBUG: Encoding 10 with 7 bits 2021-07-19 21:44:55 DEBUG: Encoding 3 with 7 bits

HMaker commented 3 years ago

Have you tried logging.getLogger('root').setLevel(logging.INFO)?

petzi75 commented 3 years ago

doesn`t help - this brings also the 127.0.... messages back anyway, I have switched back to pure uc and using now the cdp listener function - this works :)

HMaker commented 3 years ago

@petzi75 I use selenium-wire with undetected_chromedriver and don't have that logging issues (and I use logging in INFO level), but I use v1, not v2.

wkeeling commented 3 years ago

The log messages are coming out of the hpack library which is used in the background for encoding and decoding HTTP/2 data. The messages are debug level, so something in the script/application must have initialised logging at DEBUG level for these to show up. The messages can be silenced by lowering the log level to INFO or lower for just 'hpack' or the whole script/application (as @HMaker suggests). Alternatively, you can disable HTTP/2 by passing mitm_http2: False in your seleniumwire_options, but reducing the log level would be the better approach.