mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 16:42:04 -08:00
pythonlib: Support for main world evaluation 0.4.5
This commit is contained in:
parent
5dbecfdf20
commit
f6ef52a39b
3 changed files with 10 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ class CONSTRAINTS:
|
||||||
The minimum and maximum supported versions of the Camoufox browser.
|
The minimum and maximum supported versions of the Camoufox browser.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MIN_VERSION = 'beta.17'
|
MIN_VERSION = 'beta.18'
|
||||||
MAX_VERSION = '1'
|
MAX_VERSION = '1'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,7 @@ def launch_options(
|
||||||
fingerprint: Optional[Fingerprint] = None,
|
fingerprint: Optional[Fingerprint] = None,
|
||||||
ff_version: Optional[int] = None,
|
ff_version: Optional[int] = None,
|
||||||
headless: Optional[bool] = None,
|
headless: Optional[bool] = None,
|
||||||
|
main_world_eval: Optional[bool] = None,
|
||||||
executable_path: Optional[Union[str, Path]] = None,
|
executable_path: Optional[Union[str, Path]] = None,
|
||||||
firefox_user_prefs: Optional[Dict[str, Any]] = None,
|
firefox_user_prefs: Optional[Dict[str, Any]] = None,
|
||||||
proxy: Optional[Dict[str, str]] = 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.
|
Whether to run the browser in headless mode. Defaults to False.
|
||||||
Note: If you are running linux, passing headless='virtual' to Camoufox & AsyncCamoufox
|
Note: If you are running linux, passing headless='virtual' to Camoufox & AsyncCamoufox
|
||||||
will use Xvfb.
|
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]]):
|
executable_path (Optional[Union[str, Path]]):
|
||||||
Custom Camoufox browser executable path.
|
Custom Camoufox browser executable path.
|
||||||
firefox_user_prefs (Optional[Dict[str, Any]]):
|
firefox_user_prefs (Optional[Dict[str, Any]]):
|
||||||
|
|
@ -574,6 +578,10 @@ def launch_options(
|
||||||
if isinstance(humanize, (int, float)):
|
if isinstance(humanize, (int, float)):
|
||||||
set_into(config, 'humanize:maxTime', humanize)
|
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
|
# Set Firefox user preferences
|
||||||
if block_images:
|
if block_images:
|
||||||
firefox_user_prefs['permissions.default.image'] = 2
|
firefox_user_prefs['permissions.default.image'] = 2
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "camoufox"
|
name = "camoufox"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
description = "Wrapper around Playwright to help launch Camoufox"
|
description = "Wrapper around Playwright to help launch Camoufox"
|
||||||
authors = ["daijro <daijro.dev@gmail.com>"]
|
authors = ["daijro <daijro.dev@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue