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

Proxy extension cached #204

Open
kanewi11 opened this issue Apr 27, 2024 · 2 comments
Open

Proxy extension cached #204

kanewi11 opened this issue Apr 27, 2024 · 2 comments

Comments

@kanewi11
Copy link

kanewi11 commented Apr 27, 2024

I ran into a problem (apparently an extension caching issue), when passing None to proxy it still tries to connect to the proxy, even after removing the extension itself and rebooting the PC, options.remove_extensions() and driver.clear_cache() doesn't help. I'm passing the port as I recall because no other browsers were opening, I'm working with multiprocessing. Maybe the problem occurs because I'm passing the port directly?

It doesn't bother me much since my browsers are all proxy-enabled, but still, author, you're awesome, without you I wouldn't know what to do with cloudflare )

If anyone has encountered the same problem, how do you solve it? I'm interested for the future

from typing import Union

from DrissionPage import ChromiumPage, ChromiumOptions

from src.browser.proxy.plugin import ProxyPluginMixin


class BrowserDriver(ProxyPluginMixin):
    def __init__(
            self,
            proxy: Union[str, None] = None,
            port: int = None
    ):
        options = ChromiumOptions()
        options.set_local_port(port)
        options.remove_extensions()
        
        if proxy:
            options.add_extension(self.get_proxy_plugin_path(proxy))

        options.set_argument("--start-maximized")

        self.driver = ChromiumPage(addr_or_opts=options)
        self.driver.clear_cache()
@develfe
Copy link

develfe commented May 5, 2024

Do you have a folder here? (its a userdata directory)
/tmp/DrissionPage
Try to delete it.

@kanewi11
Copy link
Author

kanewi11 commented May 5, 2024

Do you have a folder here? (its a userdata directory)

/tmp/DrissionPage

Try to delete it.

I thought the same thing about userdata, but didn't go into it. I can't tell if there is a tmp directory, if I encounter this problem in other projects, I will look in that direction, now unfortunately there is no time to solve it as it is not critical. Just with selenium I have not observed this problem and I think it should not be so.

But for example on Windows, where can a temporary file be located?

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

2 participants