Comments (2)
I couldn't solve this with the default nodriver setup, I had to modify the underlying config.py in core.config:
Adding the host & port params and inheriting it from the init function instead of hardcode setting it to None.
class Config:
"""
Config object
"""
def __init__(
self,
user_data_dir: Optional[PathLike] = AUTO,
headless: Optional[bool] = False,
browser_executable_path: Optional[PathLike] = AUTO,
browser_args: Optional[List[str]] = AUTO,
sandbox: Optional[bool] = True,
lang: Optional[str] = "en-US",
host:Optional[str]="127.0.0.1",
port:Optional[int]=None,
**kwargs: dict,
):
"""
creates a config object.
Can be called without any arguments to generate a best-practice config, which is recommended.
calling the object, eg : myconfig() , will return the list of arguments which
are provided to the browser.
additional arguments can be added using the :py:obj:`~add_argument method`
Instances of this class are usually not instantiated by end users.
:param user_data_dir: the data directory to use
:param headless: set to True for headless mode
:param browser_executable_path: specify browser executable, instead of using autodetect
:param browser_args: forwarded to browser executable. eg : ["--some-chromeparam=somevalue", "some-other-param=someval"]
:param sandbox: disables sandbox
:param autodiscover_targets: use autodiscovery of targets
:param lang: language string to use other than the default "en-US,en;q=0.9"
:param kwargs:
:type user_data_dir: PathLike
:type headless: bool
:type browser_executable_path: PathLike
:type browser_args: list[str]
:type sandbox: bool
:type lang: str
:type host: str
:type port: int
:type kwargs: dict
"""
if not browser_args:
browser_args = []
if not user_data_dir:
self._user_data_dir = temp_profile_dir()
self._custom_data_dir = False
else:
self.user_data_dir = user_data_dir
if not browser_executable_path:
browser_executable_path = find_chrome_executable()
self._browser_args = browser_args
self.browser_executable_path = browser_executable_path
self.headless = headless
self.sandbox = sandbox
self.host = host
self.port = port
self._extensions = []
Then to use it'd be like this:
browser = await uc.start(
headless=False,
lang="en-US", # this could set iso-language-code in navigator, not recommended to change
browser_args=browser_args,
port=port,
host=host
)
Maybe there's a way to modify uc.config & update the remote-debugging-port that way, but I couldn't figure that out.
from undetected-chromedriver.
Related Issues (20)
- NODRIVER: how i can use nodriver to login and capture every https and cookies when login?? HOT 1
- [Nodriver] - no way to get the dimension of an element
- Changing language HOT 1
- "Enhanced ad privacy in Chrome" pop-up HOT 2
- [NODRIVER] Exception: Failed to connect to browser HOT 3
- [nodriver] support add_experimental_option
- [nodriver] support how to get page_source and current_url HOT 4
- NODRIVER - block requests HOT 1
- how do i get style attribute of a div element?
- [nodriver] support how to set timezone?
- [nodriver] how can i use a socks5 proxy with authentication? HOT 3
- This version of ChromeDriver only supports Chrome version 125 Current browser version is 124.0.6367.29 HOT 3
- NODRIVER Memory leak HOT 8
- Exsist Java Version?
- [nodriver] support how to switch iframe?
- [nodriver] load profile HOT 2
- [nodriver] support how to set cookies? HOT 1
- [nodriver] cant select from combo box
- ne of the causes could be when you are running as root. In that case you need to pass no_sandbox=True 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 undetected-chromedriver.