Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions cdp_use/cdp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,51 @@
from . import accessibility
from . import animation
from . import audits
from . import extensions
from . import autofill
from . import backgroundservice
from . import bluetoothemulation
from . import browser
from . import css
from . import cachestorage
from . import cast
from . import dom
from . import domdebugger
from . import eventbreakpoints
from . import domsnapshot
from . import domstorage
from . import deviceaccess
from . import deviceorientation
from . import emulation
from . import eventbreakpoints
from . import extensions
from . import fedcm
from . import fetch
from . import filesystem
from . import headlessexperimental
from . import io
from . import filesystem
from . import indexeddb
from . import input
from . import inspector
from . import layertree
from . import log
from . import media
from . import memory
from . import network
from . import overlay
from . import pwa
from . import page
from . import performance
from . import performancetimeline
from . import preload
from . import security
from . import serviceworker
from . import storage
from . import systeminfo
from . import target
from . import tethering
from . import tracing
from . import fetch
from . import webaudio
from . import webauthn
from . import media
from . import deviceaccess
from . import preload
from . import fedcm
from . import pwa
from . import bluetoothemulation
from . import browseruse

from .library import CDPLibrary
from .registry import EventRegistry
Expand All @@ -72,50 +73,51 @@
"accessibility",
"animation",
"audits",
"extensions",
"autofill",
"backgroundservice",
"bluetoothemulation",
"browser",
"css",
"cachestorage",
"cast",
"dom",
"domdebugger",
"eventbreakpoints",
"domsnapshot",
"domstorage",
"deviceaccess",
"deviceorientation",
"emulation",
"eventbreakpoints",
"extensions",
"fedcm",
"fetch",
"filesystem",
"headlessexperimental",
"io",
"filesystem",
"indexeddb",
"input",
"inspector",
"layertree",
"log",
"media",
"memory",
"network",
"overlay",
"pwa",
"page",
"performance",
"performancetimeline",
"preload",
"security",
"serviceworker",
"storage",
"systeminfo",
"target",
"tethering",
"tracing",
"fetch",
"webaudio",
"webauthn",
"media",
"deviceaccess",
"preload",
"fedcm",
"pwa",
"bluetoothemulation",
"browseruse",
"CDPLibrary",
"EventRegistry",
"CDPRegistrationLibrary",
Expand Down
17 changes: 15 additions & 2 deletions cdp_use/cdp/audits/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ class CorsIssueDetails(TypedDict):



UnencodedDigestError = Literal["MalformedDictionary", "UnknownAlgorithm", "IncorrectDigestType", "IncorrectDigestLength"]



class AttributionReportingIssueDetails(TypedDict):
"""Details for issues around \"Attribution Reporting API\" usage.
Explainer: https://github.com/WICG/attribution-reporting-api"""
Expand Down Expand Up @@ -281,6 +285,12 @@ class SRIMessageSignatureIssueDetails(TypedDict):



class UnencodedDigestIssueDetails(TypedDict):
error: "UnencodedDigestError"
request: "AffectedRequest"



GenericIssueErrorType = Literal["FormLabelForNameError", "FormDuplicateIdForInputError", "FormInputWithNoLabelError", "FormAutocompleteAttributeEmptyError", "FormEmptyIdAndNameAttributesForInputError", "FormAriaLabelledByToNonExistingId", "FormInputAssignedAutocompleteValueToIdOrNameAttributeError", "FormLabelHasNeitherForNorNestedInput", "FormLabelForMatchesNonExistingIdError", "FormInputHasWrongButWellIntendedAutocompleteValueError", "ResponseWasBlockedByORB"]


Expand Down Expand Up @@ -438,7 +448,7 @@ class PropertyRuleIssueDetails(TypedDict):



UserReidentificationIssueType = Literal["BlockedFrameNavigation", "BlockedSubresource"]
UserReidentificationIssueType = Literal["BlockedFrameNavigation", "BlockedSubresource", "NoisedCanvasReadback"]



Expand All @@ -449,10 +459,12 @@ class UserReidentificationIssueDetails(TypedDict):
type: "UserReidentificationIssueType"
request: "NotRequired[AffectedRequest]"
"""Applies to BlockedFrameNavigation and BlockedSubresource issue types."""
sourceCodeLocation: "NotRequired[SourceCodeLocation]"
"""Applies to NoisedCanvasReadback issue type."""



InspectorIssueCode = Literal["CookieIssue", "MixedContentIssue", "BlockedByResponseIssue", "HeavyAdIssue", "ContentSecurityPolicyIssue", "SharedArrayBufferIssue", "LowTextContrastIssue", "CorsIssue", "AttributionReportingIssue", "QuirksModeIssue", "PartitioningBlobURLIssue", "NavigatorUserAgentIssue", "GenericIssue", "DeprecationIssue", "ClientHintIssue", "FederatedAuthRequestIssue", "BounceTrackingIssue", "CookieDeprecationMetadataIssue", "StylesheetLoadingIssue", "FederatedAuthUserInfoRequestIssue", "PropertyRuleIssue", "SharedDictionaryIssue", "ElementAccessibilityIssue", "SRIMessageSignatureIssue", "UserReidentificationIssue"]
InspectorIssueCode = Literal["CookieIssue", "MixedContentIssue", "BlockedByResponseIssue", "HeavyAdIssue", "ContentSecurityPolicyIssue", "SharedArrayBufferIssue", "LowTextContrastIssue", "CorsIssue", "AttributionReportingIssue", "QuirksModeIssue", "PartitioningBlobURLIssue", "NavigatorUserAgentIssue", "GenericIssue", "DeprecationIssue", "ClientHintIssue", "FederatedAuthRequestIssue", "BounceTrackingIssue", "CookieDeprecationMetadataIssue", "StylesheetLoadingIssue", "FederatedAuthUserInfoRequestIssue", "PropertyRuleIssue", "SharedDictionaryIssue", "ElementAccessibilityIssue", "SRIMessageSignatureIssue", "UnencodedDigestIssue", "UserReidentificationIssue"]
"""A unique identifier for the type of issue. Each type may use one of the
optional fields in InspectorIssueDetails to convey more specific
information about the kind of issue."""
Expand Down Expand Up @@ -488,6 +500,7 @@ class InspectorIssueDetails(TypedDict, total=False):
sharedDictionaryIssueDetails: "SharedDictionaryIssueDetails"
elementAccessibilityIssueDetails: "ElementAccessibilityIssueDetails"
sriMessageSignatureIssueDetails: "SRIMessageSignatureIssueDetails"
unencodedDigestIssueDetails: "UnencodedDigestIssueDetails"
userReidentificationIssueDetails: "UserReidentificationIssueDetails"


Expand Down
9 changes: 9 additions & 0 deletions cdp_use/cdp/browseruse/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is auto-generated by the CDP protocol generator.
# Do not edit this file manually as your changes will be overwritten.
# Generated from Chrome DevTools Protocol specifications.

"""CDP BrowserUse Domain"""

from .types import *
from .commands import *
from .events import *
8 changes: 8 additions & 0 deletions cdp_use/cdp/browseruse/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is auto-generated by the CDP protocol generator.
# Do not edit this file manually as your changes will be overwritten.
# Generated from Chrome DevTools Protocol specifications.

"""CDP BrowserUse Domain Commands"""


# No commands defined for this domain
33 changes: 33 additions & 0 deletions cdp_use/cdp/browseruse/events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file is auto-generated by the CDP protocol generator.
# Do not edit this file manually as your changes will be overwritten.
# Generated from Chrome DevTools Protocol specifications.

"""CDP BrowserUse Domain Events"""

from typing_extensions import NotRequired, TypedDict

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ..target.types import TargetID

"""Captcha solving started."""
class CaptchaSolverStartedEvent(TypedDict):
targetId: "TargetID"
vendor: "str"
url: "str"
startedAt: "int"
"""Unix millis"""
eventTimeout: "NotRequired[float]"



"""Captcha solving finished."""
class CaptchaSolverFinishedEvent(TypedDict):
targetId: "TargetID"
vendor: "str"
url: "str"
durationMs: "int"
finishedAt: "int"
"""Unix millis"""
eventTimeout: "NotRequired[float]"
19 changes: 19 additions & 0 deletions cdp_use/cdp/browseruse/library.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is auto-generated by the CDP protocol generator.
# Do not edit this file manually as your changes will be overwritten.
# Generated from Chrome DevTools Protocol specifications.

"""CDP BrowserUse Domain Library"""


from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ...client import CDPClient

class BrowserUseClient:
"""Client for BrowserUse domain commands."""

def __init__(self, client: 'CDPClient'):
self._client = client


51 changes: 51 additions & 0 deletions cdp_use/cdp/browseruse/registration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This file is auto-generated by the CDP protocol generator.
# Do not edit this file manually as your changes will be overwritten.
# Generated from Chrome DevTools Protocol specifications.

"""CDP BrowserUse Domain Event Registration"""

from typing import Callable, Optional

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ..registry import EventRegistry
from .events import CaptchaSolverFinishedEvent, CaptchaSolverStartedEvent

class BrowserUseRegistration:
"""Event registration interface for BrowserUse domain."""

def __init__(self, registry: 'EventRegistry'):
self._registry = registry
self._domain = "BrowserUse"

def captchaSolverStarted(
self,
callback: Callable[['CaptchaSolverStartedEvent', Optional[str]], None],
) -> None:
"""
Register a callback for captchaSolverStarted events.

Captcha solving started.

Args:
callback: Function to call when event occurs.
Receives (event_data, session_id) as parameters.
"""
self._registry.register("BrowserUse.captchaSolverStarted", callback)

def captchaSolverFinished(
self,
callback: Callable[['CaptchaSolverFinishedEvent', Optional[str]], None],
) -> None:
"""
Register a callback for captchaSolverFinished events.

Captcha solving finished.

Args:
callback: Function to call when event occurs.
Receives (event_data, session_id) as parameters.
"""
self._registry.register("BrowserUse.captchaSolverFinished", callback)

8 changes: 8 additions & 0 deletions cdp_use/cdp/browseruse/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is auto-generated by the CDP protocol generator.
# Do not edit this file manually as your changes will be overwritten.
# Generated from Chrome DevTools Protocol specifications.

"""CDP BrowserUse Domain Types"""


# No types defined for this domain
14 changes: 11 additions & 3 deletions cdp_use/cdp/css/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"""CDP CSS Domain Commands"""

from typing import List
from typing import Any, Dict, List
from typing_extensions import NotRequired, TypedDict

from typing import TYPE_CHECKING
Expand All @@ -29,6 +29,7 @@
from .types import CSSScope
from .types import CSSStyle
from .types import CSSSupports
from .types import ComputedStyleExtraFields
from .types import InheritedAnimatedStyleEntry
from .types import InheritedPseudoElementMatches
from .types import InheritedStyleEntry
Expand Down Expand Up @@ -134,13 +135,15 @@ class GetComputedStyleForNodeParameters(TypedDict):
class GetComputedStyleForNodeReturns(TypedDict):
computedStyle: "List[CSSComputedStyleProperty]"
"""Computed style for the specified DOM node."""
extraFields: "ComputedStyleExtraFields"
"""A list of non-standard \"extra fields\" which blink stores alongside each
computed style."""



class ResolveValuesParameters(TypedDict):
values: "List[str]"
"""Substitution functions (var()/env()/attr()) and cascade-dependent
keywords (revert/revert-layer) do not work."""
"""Cascade-dependent keywords (revert/revert-layer) do not work."""
nodeId: "NodeId"
"""Id of the node in whose context the expression is evaluated"""
propertyName: "NotRequired[str]"
Expand Down Expand Up @@ -231,6 +234,11 @@ class GetMatchedStylesForNodeReturns(TypedDict):



class GetEnvironmentVariablesReturns(TypedDict):
environmentVariables: "Dict[str, Any]"



class GetMediaQueriesReturns(TypedDict):
medias: "List[CSSMedia]"

Expand Down
13 changes: 13 additions & 0 deletions cdp_use/cdp/css/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .commands import GetBackgroundColorsReturns
from .commands import GetComputedStyleForNodeParameters
from .commands import GetComputedStyleForNodeReturns
from .commands import GetEnvironmentVariablesReturns
from .commands import GetInlineStylesForNodeParameters
from .commands import GetInlineStylesForNodeReturns
from .commands import GetLayersForNodeParameters
Expand Down Expand Up @@ -252,6 +253,18 @@ async def getMatchedStylesForNode(
session_id=session_id,
))

async def getEnvironmentVariables(
self,
params: None = None,
session_id: Optional[str] = None,
) -> "GetEnvironmentVariablesReturns":
"""Returns the values of the default UA-defined environment variables used in env()"""
return cast("GetEnvironmentVariablesReturns", await self._client.send_raw(
method="CSS.getEnvironmentVariables",
params=params,
session_id=session_id,
))

async def getMediaQueries(
self,
params: None = None,
Expand Down
Loading