raena-crawler-engine/noon_crawler_engine/test.py

30 lines
955 B
Python

import hashlib
import logging
#import undetected_chromedriver as webdriver
from selenium import webdriver
from selenium.webdriver import ActionChains, Keys
from selenium.webdriver.chrome.service import Service
import psycopg2
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from noon_db_writer import noon_db_writer
from pyvirtualdisplay import Display
from scroller.scroller import smartScroll
import time
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
driver = webdriver.Firefox()
driver.get('https://www.noon.com/uae-en/beauty/')
driver.implicitly_wait(5)
elements = driver.find_element(By.XPATH, '//*[@id="__next"]/div/section/div/div/div[23]/div/div/div/div/div/div/div/div/div[2]/div[1]/div').find_elements(By.CSS_SELECTOR,'.swiper-slide')
for element in elements:
link = element.find_element(By.TAG_NAME, 'a').get_attribute('href')
print(link)
driver.close()