My question is related to this post: Enter query in search bar and scrape results
I am able to execute the answer given to this former question, but am not able to scrape data from the website that Chrome navigates to by the looping over book
. I only found answers that would show how to scrape data from d
in my code, but not from the search result after having used send_keys
.
I tried to access the element but can't do so and I would like to scrape the data from the resulting website after searching for book
and then going to the next round of the loop.
I tried:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
d = webdriver.Chrome('mypath/chromedriver.exe')
books = ['9780062457738']
for book in books:
d.get('https://www.bol.com/nl/')
e = d.find_element_by_id('searchfor')
f = print(e.send_keys(book, Keys.ENTER))
I also tried without the print()
function but it returns no real element if I type f?
I get:
Type: NoneType
String form: None
Docstring: <no docstring>
Any help on how to parse the data of for example the author of the book, title or other information after having submitted a search query is very welcome!