I have read similar answers but it doesnt seem to be working for me . I am trying to scrape product names from a website
driver = webdriver.Chrome(DRIVER_PATH,options=options)
website = 'https://bodyandmind.com/california/longbeachdispensary/longbeachmenu/?category=flower#inventory'
driver.get(website)
time.sleep(3)
confirmation = driver.find_element(By.CSS_SELECTOR,'button.age-gate-submit.age-gate-submit-yes').click()
time.sleep(3)
root1=driver.find_element(By.CSS_SELECTOR, "weave-ordering").shadow_root
root2=root1.find_element(By.CSS_SELECTOR, "weave-app").shadow_root
root3=root2.find_element(By.CSS_SELECTOR, "weave-inventory").shadow_root
root4=root3.find_element(By.CSS_SELECTOR, "weave-product-list").shadow_root
root5=root4.find_element(By.CSS_SELECTOR, "weave-category-section").shadow_root
root6=root5.find_element(By.CSS_SELECTOR, "weave-product").shadow_root
element=root6.find_element(By.CSS_SELECTOR, "[class='product-container']")
print(element.text)
Running it is giving me the following error :
Traceback (most recent call last):
File "/Users/japneeshsingh/Desktop/try.py", line 29, in <module>
root1=driver.find_element(By.CSS_SELECTOR, "weave-ordering").shadow_root
File "/Users/japneeshsingh/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 252, in shadow_root
return self._execute(Command.GET_SHADOW_ROOT)["value"]
File "/Users/japneeshsingh/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 403, in _execute
return self._parent.execute(command, params)
File "/Users/japneeshsingh/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "/Users/japneeshsingh/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchShadowRootException: Message: no such shadow root