Python list title 文字取得

Python list title 文字取得

import os
import time
from selenium import webdriver
import chromedriver_binary

def load_button():
    # load_button click
    load_button = driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div[4]/a")
    load_button.click()
    time.sleep(3)

# URL
search_url = "https://www.seprace.com/category/1?gender=1,4"

# Chrome webdriver setting
options = webdriver.ChromeOptions()
options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=options)
driver.get(search_url)
time.sleep(2)

all_count = driver.find_element_by_xpath("/html/body/div/div/div[2]/div[4]/div[1]/div/h1/div/span").text
# print(all_count.split("/t")[0])
all_count_int = int(all_count.replace("(", '').split()[0])
page_count = 60
print(str(all_count_int))
print(str(page_count))
print(str(all_count_int/page_count))


# click load button
for i in range(1):
    load_button()

# get data
temp_result_list = driver.find_elements_by_class_name('product-name')
result_list = []
for x in range(len(temp_result_list)):
    result_list.append(temp_result_list[x].text)
print(len(result_list))

# make file
with open("C:/work/git/result_list.txt", mode='w') as f:
    f.write("\n".join(result_list))
f.close()
driver.close()