webfp / tor-browser-selenium

Tor Browser automation with Selenium.
MIT License
548 stars 100 forks source link

Disabling INFO / NOTE logs and JavaScript #154

Closed beencanteen closed 2 years ago

beencanteen commented 3 years ago

I was wondering if there is a way to disable the terminal logging statements that begin with

[07-29:01:09:32] Torbutton INFO: ...
[07-29:01:09:32] Torbutton NOTE: ...

I was also wondering how you can disable JavaScript. Here is what I have tried:

pref_dict = {"noscript.global": False, "extensions.torbutton.security_custom": True}
driver = TorBrowserDriver("/path/to/my/tor-browser_en-US/", tor_cfg=pref_dict)
gunesacar commented 3 years ago

I was wondering if there is a way to disable the terminal logging statements that begin with

The pref that controls the Torbutton log level is: extensions.torbutton.loglevel You may want to try different levels to find the one that suits your needs.

I was also wondering how you can disable JavaScript. Here is what I have tried:

You can set the security level to "High" ( "Safest") to disable JavaScript. See the test here: https://github.com/webfp/tor-browser-selenium/blob/main/tbselenium/test/test_set_security_level.py#L84

Sorry for the delayed response.

Mostalk commented 2 years ago

The pref that controls the Torbutton log level is: extensions.torbutton.loglevel

Can you get code of this? I don't understand how to change extersions value

gunesacar commented 2 years ago

Would be something like this:

with TorBrowserDriver(TBB_PATH, pref_dict={'extensions.torbutton.loglevel': LOG_LEVEL}) as driver:
    driver.load_url(...)