# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

from selenium import webdriver

from selenium.common.exceptions import NoSuchElementException

import json

import re

import urllib.request

url = "https://www.bata.id/men/category/sandal"

driver = webdriver.PhantomJS()

driver.implicitly_wait(10)

driver.get(url)

print(driver.current_url)

products = []
images = []

while True:    
    for product in driver.find_elements_by_xpath("//div[@class='product details product-item-details']"):
        if product.text != '':
            details = re.split('\n',product.text)
            if(len(details) == 2):
                products.append(
                {
                    'Model': details[0],
                    'Harga': details[1],
                })
    try:
        driver.find_element_by_xpath("//a[@class='action  next']").click()
    except NoSuchElementException as e:
        break;

products

StarcoderdataJupyterScriptsDedupFiltered