In below python/requests_html I'm trying to scrape Amazon and get the Ender 3 3D Printer with r.html.xpath("//ul/li[3]/span/span[2]")
but it returns []
(I want it to return Ender 3
).
from requests_html import HTMLSession
with HTMLSession() as session:
r = session.get('https://www.amazon.com/dp/B07BR3F9N6')
r.html.xpath("//ul/li[3]/span/span[2]")
I added r.html.render()
because I want to render the web ,but it returns the error
RuntimeError: Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.
from requests_html import HTMLSession
with HTMLSession() as session:
r = session.get('https://www.amazon.com/dp/B07BR3F9N6')
r.html.render() # <--- Issue Here
r.html.xpath("//ul/li[3]/span/span[2]")
Can anyone help? Thanks!
I had the same issue and I found the solution:
Python==3.6
pip install chromedriver-py