Hello,
Trying to scrape this url: https://coloradosprings.gov/cityleadership
and I am trying to remove any nav class, with this code:
elements = await page.query_selector_all(
'[class*="nav"]',
)
for element in elements:
await element.evaluate("node => node.remove()")
and I am getting this error:
File \"/Users/bmax/.pyenv/versions/contacts/lib/python3.10/site-packages/playwright/async_api/_generated.py\", line 8217, in query_selector_all\n await self._impl_obj.query_selector_all(selector=selector)\n File \"/Users/bmax/.pyenv/versions/contacts/lib/python3.10/site-packages/playwright/_impl/_page.py\", line 337, in query_selector_all\n return await self._main_frame.query_selector_all(selector)\n File \"/Users/bmax/.pyenv/versions/contacts/lib/python3.10/site-packages/playwright/_impl/_frame.py\", line 301, in query_selector_all\n return list(\n File \"/Users/bmax/.pyenv/versions/contacts/lib/python3.10/site-packages/playwright/_impl/_connection.py\", line 509, in from_channel\n return channel._object\nAttributeError: 'dict' object has no attribute '_object'
Any ideas?
This thread is trying to answer question "Why am I getting an error 'dict' object has no attribute '_object' when trying to remove nav class while scraping a URL using Python?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].