from selenium import webdriver
def get_url_list():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
browser = webdriver.Chrome(chrome_options=chrome_options)
url='https://fgo.wiki/w/%E8%8B%B1%E7%81%B5%E5%9B%BE%E9%89%B4'
browser.get(url)
browser.implicitly_wait(3)
select = browser.find_element_by_id('per-page')
select.find_element_by_xpath('option[4]').click()
table = browser.find_element_by_id('lancelot_table_servantlist')
trs = table.find_elements_by_xpath('./tbody/tr')
url_list = []
for tr in trs[1:]:
url = tr.find_element_by_xpath('td[2]/a').get_attribute('href')
url_list.append(url)
browser.quit()
return url_list
lists = get_url_list()
for list in lists:
print(list)