from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait import xlwt from xlwt import Workbook import mouse import time import xlrd i = 1 allgropath = "https://allegro.pl/listing?string=" order = "&order=p" s: Service = Service('C://webdriver/chromedriver.exe') driver = webdriver.Chrome(service=s) wb = Workbook() sheet1 = wb.add_sheet('ceny allegro') driver.get('https://allegro.pl/listing?string=5901738907737&order=p') driver.maximize_window() driver.implicitly_wait(5) mouse.move(550, 1000, absolute=True, duration=1.8) mouse.click() mouse.move(750, 500, absolute=True, duration=1.8) time.sleep(2) mouse.click() time.sleep(8) search = driver.find_element(By.CLASS_NAME, '_7030e_1tOgC') sheet1.write(1, 0, search.text) while i <= 6: PATH = 'exel\ean.xls' #####path do exela exel = xlrd.open_workbook(PATH) ##### otweiranie exela do zmiennej exel_sheet1 = exel.sheet_by_index(0) ####otwieranie sheetu index = 0 exel_value = exel_sheet1.cell_value(1 + i, 0) #####wiersze,kolumny exel_url = allgropath + exel_value + order driver.get(exel_url) mouse.move(750, 650, absolute=True, duration=1.8) time.sleep(2) mouse.click() search = driver.find_element(By.CLASS_NAME, '_7030e_1tOgC') sheet1.write(1 + i, 0, search.text) i += 1 time.sleep(8) wb.save('test.xls')