selenium ベース

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By

options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument(
     "user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36"
)

driver = webdriver.Chrome("chromedriver", options=options)
driver.implicitly_wait(10)

# URL
driver.get("")

# 親ウインドウ
parent_window = driver.current_window_handle

driver.find_elements(By.CLASS_NAME, "")
driver.find_elements(By.CSS_SELECTOR, "")
driver.find_element(By.ID, "")
driver.find_element(By.LINK_TEXT, "")
driver.find_element(By.NAME, "")
driver.find_element(By.TAG_NAME, "")
driver.find_element(By.XPATH, "")

# .click()
# .text

# 子ウインドウ切替
driver.switch_to.window(driver.window_handles[-1])

driver.current_url
driver.close()

# 親ウインドウ切替
driver.switch_to.window(parent_window)


# 次のページ
try:
    driver.find_element(By.CSS_SELECTOR, "").click()

except NoSuchElementException:
    driver.quit()