I have a python script that downloads images from a website based on values taken in an excel sheet. I, however, keep getting an error like this:
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
WARNING: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors (tensor#141 is a dynamic-sized tensor).
It never used to appear, the code would just run and finish executing. But after the appearance of this error, the program just ends abruptly.
I have pasted my code below.
Idk for what reason, but it doesnt delete the rows from the excel sheet as well. Any idea why?
import os
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from pynput.keyboard import Key, Controller
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from openpyxl import Workbook, load_workbook
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
def onescript(driver):
book = load_workbook('trial.xlsx')
sheet1 = book.active
print(driver.title)
driver.get("https://www.jaquar.com/en/") #Open the web page
for i in range(1,4):
prod_id = sheet1.cell(row=i+1, column=2).value
#Click add Product :
search_product = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "small-searchterms"))
)
search_product.clear()
search_product.send_keys(prod_id)
search_product.send_keys(Keys.ENTER)
# time.sleep(2)
book.save('trial.xlsx')
if driver.find_elements(By.CLASS_NAME, "button-2"):
# Click add Image :
click_details = WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.CLASS_NAME, "button-2"))
)
click_details.click()
# Download image - Set download directory if needed( same as the one to upload )
download_image = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "download-image"))
)
download_image.click()
product_found = True
if not product_found:
print("No product found")
sheet1.delete_rows(i, 1) # Delete the row where the product was not found
book.save('updated_trial.xlsx')
else:
# Reset the index if a row was deleted
pass
book.save('trial.xlsx')
absolute_path = os.path.dirname(__file__)
relative_path1 = "drivers\chromedriver-win64\chromedriver.exe"
full_path_cdriver = os.path.join(absolute_path, relative_path1)
relative_path2 = "drivers\chrome-win64\chrome.exe"
full_path_chrome = os.path.join(absolute_path, relative_path2)
#Upload your user-data folder so that the testing browser can know your cookies
options = Options()
options.add_argument("user-data-dir=C:/Users/xyzs/AppData/Local/Google/Chrome for Testing/User Data")
options.binary_location = full_path_chrome
service = Service(executable_path=full_path_cdriver)
driver = webdriver.Chrome(options=options, service=service)
onescript(driver)
This is the code. Any help is appreciated.