I'm trying to create a 'bot' to buy a graphics card. I've downloaded a pre-made script, and i'm trying to adjust to my needs.
Script take me to the site in Firefox, finds the button I am trying to look for using the following code:
findAllCards = soup.find('button', {'class': 'Button__StyledButton-iESSlv dJJJCD Button-dtUzzq kHUYTy'})
This works. However, when I an trying to click the button, I am unable to as I have no idea what I am suppose to find here: driverWait(driver, 'css', '.space-b center')
Webpage I'm using to test is: https://www.currys.co.uk/gbuk/gaming/console-gaming/controllers/xbox-wireless-controller-carbon-black-10211565-pdt.html
Full code here:
driver.get(url) while True: html = driver.page_source soup = bs4.BeautifulSoup(html, 'html.parser') wait = WebDriverWait(driver, 15) wait2 = WebDriverWait(driver, 2) try: findAllCards = soup.find('button', {'class': 'Button__StyledButton-iESSlv dJJJCD Button-dtUzzq kHUYTy'}) if findAllCards: print(f'Button Found!: {findAllCards.get_text()}') # Clicking Add to Cart. time.sleep(.3) print('Click') driverWait(driver, 'css', '.space-b center') print('Click1') time.sleep(2)
Thanks :)
https://stackoverflow.com/questions/66823848/clicking-button-on-webpage-using-selenium-python-beautifulsoup March 27, 2021 at 04:22AM
没有评论:
发表评论