@@ -390,6 +390,8 @@ class BrowserConfig:
390390 light_mode (bool): Disables certain background features for performance gains. Default: False.
391391 extra_args (list): Additional command-line arguments passed to the browser.
392392 Default: [].
393+ enable_stealth (bool): If True, applies playwright-stealth to bypass basic bot detection.
394+ Cannot be used with use_undetected browser mode. Default: False.
393395 """
394396
395397 def __init__ (
@@ -430,6 +432,7 @@ def __init__(
430432 extra_args : list = None ,
431433 debugging_port : int = 9222 ,
432434 host : str = "localhost" ,
435+ enable_stealth : bool = False ,
433436 ):
434437 self .browser_type = browser_type
435438 self .headless = headless
@@ -470,6 +473,7 @@ def __init__(
470473 self .verbose = verbose
471474 self .debugging_port = debugging_port
472475 self .host = host
476+ self .enable_stealth = enable_stealth
473477
474478 fa_user_agenr_generator = ValidUAGenerator ()
475479 if self .user_agent_mode == "random" :
@@ -501,6 +505,13 @@ def __init__(
501505 # If persistent context is requested, ensure managed browser is enabled
502506 if self .use_persistent_context :
503507 self .use_managed_browser = True
508+
509+ # Validate stealth configuration
510+ if self .enable_stealth and self .use_managed_browser and self .browser_mode == "builtin" :
511+ raise ValueError (
512+ "enable_stealth cannot be used with browser_mode='builtin'. "
513+ "Stealth mode requires a dedicated browser instance."
514+ )
504515
505516 @staticmethod
506517 def from_kwargs (kwargs : dict ) -> "BrowserConfig" :
@@ -537,6 +548,7 @@ def from_kwargs(kwargs: dict) -> "BrowserConfig":
537548 extra_args = kwargs .get ("extra_args" , []),
538549 debugging_port = kwargs .get ("debugging_port" , 9222 ),
539550 host = kwargs .get ("host" , "localhost" ),
551+ enable_stealth = kwargs .get ("enable_stealth" , False ),
540552 )
541553
542554 def to_dict (self ):
@@ -571,6 +583,7 @@ def to_dict(self):
571583 "verbose" : self .verbose ,
572584 "debugging_port" : self .debugging_port ,
573585 "host" : self .host ,
586+ "enable_stealth" : self .enable_stealth ,
574587 }
575588
576589
0 commit comments