使用 Scrapy-Playwright 访问 aria-hidden 元素

问题描述 投票:0回答:0

我正在使用 scrapy 访问响应元素。由于此元素是隐藏的,因此它返回一个空对象。 我怎样才能让这个对象可见?

<div class="listing-content-provider-i0v7mt" data-genesis-element="CARD_HEADER_CONTAINER" aria-expanded="false" aria-controls="stepstone-disclosure-6147" tabindex="0">...</div>

也可以点击这个元素。然而,这似乎也行不通。

    async def parse_jobs(self, response):
        meta=dict(
            playwright=True,
            playwright_include_page = True,
            playwright_page_methods = [
                #Waiting for the class 
                PageMethod('wait_for_selector', 'div.listing-content-provider-i0v7mt','aria-expanded="true"'),
                # or
                PageMethod('click', 'div.listing-content-provider-i0v7mt'),
                ]
            )
python-3.x scrapy css-selectors
© www.soinside.com 2019 - 2024. All rights reserved.