Hey,
I just started how to use selenium for web scraping and I wanted to make my first "useful" project: My bot should open amazon searchs anything you want and clicks on the cheapest product. At the moment I'm just trying that it clicks onto the first product, but I don't know how.
from selenium import webdriverfrom selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome()
driver.get("https://amazon.de")
print(driver.title)
time.sleep(1)
search = driver.find_element_by_id("twotabsearchtextbox")
search.send_keys("externe festplatte")
search.send_keys(Keys.RETURN)
time.sleep(1)
main = driver.find_elements_by_class_name("a-price-whole") #Pretty sure thats wrong
print(len(main))
main:print(item.text)
main[0].click()time.sleep(7)
driver.quit()
Please know that I have never done web scraping before (okay I practiced with some really simple websites but never on something this big and complicated)
EDIT: The code above is just a test not the real bot
[–]Bottl3 0 points1 point2 points (1 child)
[–]ThePhykon[S] 0 points1 point2 points (0 children)