Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no driver, looking for proxies solution #1845

Open
Drey7k opened this issue Apr 25, 2024 · 12 comments
Open

no driver, looking for proxies solution #1845

Drey7k opened this issue Apr 25, 2024 · 12 comments

Comments

@Drey7k
Copy link

Drey7k commented Apr 25, 2024

hello, I want to use proxies list from a txt (ip:port:user:pass) for a simple ATC script, I am looking for an exemple because I tried tons of things and spent 2 days without any result. Have a good day

@b-nnett
Copy link

b-nnett commented Apr 26, 2024

@Drey7k
Copy link
Author

Drey7k commented Apr 26, 2024

https://stackoverflow.com/questions/55582136/how-to-set-proxy-with-authentication-in-selenium-chromedriver-python

Check the accepted answer.

thanks but already tried and not working

@oculunto
Copy link

Any idea how to make it work ?
I cannot seem to be able to load the extension that I create into the no driver chrome browser.
I have tried with config.add_extension=extensionDir , config.add_argument = r'--load-extension='+extensionDir , and browser = await uc.start(browser_args=['--load-extension='+extensionDir]) and none of them loads the extension properly (manifest + json), which works properly on the old undetected-chrome.
The config argument for a data_dir for example works properly, but not for extensions.

@develfe
Copy link

develfe commented May 5, 2024

Any idea how to make it work ? I cannot seem to be able to load the extension that I create into the no driver chrome browser. I have tried with config.add_extension=extensionDir , config.add_argument = r'--load-extension='+extensionDir , and browser = await uc.start(browser_args=['--load-extension='+extensionDir]) and none of them loads the extension properly (manifest + json), which works properly on the old undetected-chrome. The config argument for a data_dir for example works properly, but not for extensions.

I have the same problem with NoDriver. It is interesting to note that this appears under Centos, but under Windows 10 it works fine.
nodriver 0.29rc2
Python 3.12.3
undetected-chromedriver 3.5.5
Google Chrome 124.0.6367.118

@oculunto
Copy link

oculunto commented May 5, 2024

That's weird, I'm on windows 10 and it does not work. I tried using manifest v2 and v3 to no avail.
I tried opening a window and then loading the extension manually, and it does work though.

@develfe
Copy link

develfe commented May 5, 2024

MANIFEST.JSON and BACKGROUND.JS:

{
    "version": "1.0.0",
    "manifest_version": 2,
    "name": "Proxies",
    "permissions": [
        "proxy",
        "tabs",
        "unlimitedStorage",
        "storage",
        "<all_urls>",
        "webRequest",
        "webRequestBlocking"
    ],
    "background": {
        "scripts": ["background.js"]
    },
    "minimum_chrome_version":"22.0.0"
}

@develfe
Copy link

develfe commented May 5, 2024

var config = {
        mode: "fixed_servers",
        rules: {
        singleProxy: {
            scheme: "http",
            host: "X.X.X.X",
            port: parseInt(X)
        },
        bypassList: ["localhost"]
        }
    };

chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});

function callbackFn(details) {
    return {
        authCredentials: {
            username: "xxxxxx",
            password: "xxxxxx"
        }
    };
}

chrome.webRequest.onAuthRequired.addListener(
            callbackFn,
            {urls: ["<all_urls>"]},
            ['blocking']
);

@oculunto
Copy link

oculunto commented May 5, 2024

Yeah thanks, I have something like that yes, but no driver won't load it... i create both files and try to load them with the previously mentioned methods, but it doesn't load it. But if I open an uc no driver window, and go to extensions, I can select that same directory it created and it will load the extension well... (I have to enable developer mode before though...)
Are you using no driver or undetected-chromedriver ? (in undetected it works just fine)

@develfe
Copy link

develfe commented May 5, 2024

Proxy authorization with undetected-chromedriver works fine for me on both Centos and Windows 10. The problem is with NoDriver.

@develfe
Copy link

develfe commented May 7, 2024

Apparently, I found the cause of the problem with NoDriver under Centos. The extension didn`t have time to load due to a rather slow VPS.

Solution:

Edit File: nodriver/core/browser.py
#331: await asyncio.sleep(0.25) -> await asyncio.sleep(2.5)

It would be great to add this option to the settings.

@oculunto
Copy link

oculunto commented May 7, 2024

Did not work for me, but thanks for updating !

@oculunto
Copy link

oculunto commented May 8, 2024

Found a solution for mine, I was using add_extension wrong, the right way to do it is config1.add_extension(extensionDir)
unlike user_data_dir or browser_executable_path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants