Closed
Description
sb.cdp.get_attribute(selector, attribute)
may fail with TypeError
It makes a call to element.get_js_attributes()
to get all attributes before returning the desired one, but there's a bug in that:
*** TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "~/github/SeleniumBase/seleniumbase/core/sb_cdp.py", line 85, in <lambda>
element.get_js_attributes = lambda: self.__get_js_attributes(element)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "~/github/SeleniumBase/seleniumbase/core/sb_cdp.py", line 515, in __get_js_attributes
self.loop.run_until_complete(element.get_js_attributes_async())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 720, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "~/github/SeleniumBase/seleniumbase/undetected/cdp_driver/element.py", line 389, in get_js_attributes_async
await self.apply(
...<9 lines>...
)
File "~/github/SeleniumBase/seleniumbase/undetected/cdp_driver/element.py", line 445, in apply
elif result[1]:
~~~~~~^^^
Also calling element.get_attribute(attribute)
from CDP Mode may lead to that.