I am trying to make a stock bot that checks if something is in stock and when I try to use:
if ATC.isDisplayed():
I get the error:
AttributeError: 'list' object has no attribute 'isDisplayed'
My whole code:
import time
import asyncio
import colorama
import subprocess
from colorama import Fore, Back, Style
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.expected_conditions import presence_of_element_located
driver = webdriver.Chrome(
executable_path=r'C:\Users\Joe mama\Desktop\app\chromedriver.exe')
colorama.init(autoreset=True)
driver.get("https://www.currys.co.uk/gbuk/computing-accessories/components-upgrades/graphics-cards/msi-geforce-rtx-3060-ti-8-gb-gaming-x-trio-graphics-card-10219250-pdt.html")
driver.maximize_window()
Name = driver.find_elements_by_css_selector(
"#content > div.product-page > section > div.to-print > h1 > span:nth-child(2)")
Price = driver.find_elements_by_css_selector(
"#product-actions > div.amounts > div > div > span.ProductPriceBlock__Price-kTVxGg.QWqil")
Link = driver.find_elements_by_tag_name("a")
OOS = driver.find_elements_by_css_selector(
"#product-actions > div.oos.oos-no-alt.border.space-b > strong")
ATC = driver.find_elements_by_css_selector(
"#product-actions > div.channels.space-b > div.space-b.center > button")
while True:
try:
if OOS.isDisplayed():
print(colorama.Fore.RED +
f"|| {Name[0].text} || Out Of Stock || {Price[0].text} ||")
driver.refresh()
except:
if ATC.isDisplayed():
print(colorama.Fore.GREEN +
f'|| {Name[0].text} || IN STOCK || {Price[0].text} ||')
If anyone could help that would be very helpful, I've been trying to figure this out for ages.