scrapy-plugins / scrapy-zyte-api

Zyte API integration for Scrapy
BSD 3-Clause "New" or "Revised" License
36 stars 19 forks source link

Using browser actions raises a TypeError #187

Closed fcanobrash closed 7 months ago

fcanobrash commented 7 months ago

Hi team.

Following the example to use Browser Actions, we're getting the following error:

File ".../lib/python3.11/site-packages/scrapy_zyte_api/_annotations.py", line 62, in <genexpr> return tuple(frozenset(action.items()) for action in value) TypeError: unhashable type: 'dict'

We're using the same code from the documentation:

from typing import Annotated

from scrapy_zyte_api import Actions, actions

@attrs.define
class MyPageObject(BasePage):
    product: Product
    actions: Annotated[
        Actions,
        actions(
            [
                {
                    "action": "click",
                    "selector": {"type": "css", "value": "button#openDescription"},
                    "delay": 0,
                    "button": "left",
                    "onError": "return",
                },
                {
                    "action": "waitForTimeout",
                    "timeout": 5,
                    "onError": "return"
                },
            ]
        ),
    ]
Gallaecio commented 7 months ago

https://github.com/scrapy-plugins/scrapy-zyte-api/pull/188