mirror of
https://github.com/daijro/camoufox.git
synced 2026-09-05 16:00:41 +00:00
pythonlib: Support for main world evaluation 0.4.5
This commit is contained in:
@@ -8,7 +8,7 @@ class CONSTRAINTS:
|
||||
The minimum and maximum supported versions of the Camoufox browser.
|
||||
"""
|
||||
|
||||
MIN_VERSION = 'beta.17'
|
||||
MIN_VERSION = 'beta.18'
|
||||
MAX_VERSION = '1'
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -354,6 +354,7 @@ def launch_options(
|
||||
fingerprint: Optional[Fingerprint] = None,
|
||||
ff_version: Optional[int] = None,
|
||||
headless: Optional[bool] = None,
|
||||
main_world_eval: Optional[bool] = None,
|
||||
executable_path: Optional[Union[str, Path]] = None,
|
||||
firefox_user_prefs: Optional[Dict[str, Any]] = None,
|
||||
proxy: Optional[Dict[str, str]] = None,
|
||||
@@ -416,6 +417,9 @@ def launch_options(
|
||||
Whether to run the browser in headless mode. Defaults to False.
|
||||
Note: If you are running linux, passing headless='virtual' to Camoufox & AsyncCamoufox
|
||||
will use Xvfb.
|
||||
main_world_eval (Optional[bool]):
|
||||
Whether to enable running scripts in the main world.
|
||||
To use this, prepend "mw:" to the script: page.evaluate("mw:" + script).
|
||||
executable_path (Optional[Union[str, Path]]):
|
||||
Custom Camoufox browser executable path.
|
||||
firefox_user_prefs (Optional[Dict[str, Any]]):
|
||||
@@ -574,6 +578,10 @@ def launch_options(
|
||||
if isinstance(humanize, (int, float)):
|
||||
set_into(config, 'humanize:maxTime', humanize)
|
||||
|
||||
# Enable the main world context creation
|
||||
if main_world_eval:
|
||||
set_into(config, 'allowMainWorld', True)
|
||||
|
||||
# Set Firefox user preferences
|
||||
if block_images:
|
||||
firefox_user_prefs['permissions.default.image'] = 2
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry]
|
||||
name = "camoufox"
|
||||
version = "0.4.4"
|
||||
version = "0.4.5"
|
||||
description = "Wrapper around Playwright to help launch Camoufox"
|
||||
authors = ["daijro <daijro.dev@gmail.com>"]
|
||||
license = "MIT"
|
||||
|
||||
Reference in New Issue
Block a user