I'd like to scrape product links (675 products) from a website. The first page has only 24 products with a "Show Next 23" button. I tried two methods to load more products so I can get their links.
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome()
wait = WebDriverWait(driver, 10)
driver.get('https://www.3m.com.au/3M/en_AU/p/c/medical')
while True:
try:
more_button = wait.until(EC.visibility_of_element_located((By.CLASS_NAME, 'MMM--
btn MMM--btn_tertiary MMM--btn_noAnimation js-pageLoader wt-link wtLoaded mix-
MMM--btn_allCaps'))).click()
except TimeoutException:
break
I also tried
more_button = wait.until(EC.visibility_of_element_located((By.XPATH,'
//*@id="pageContent"]/div[3]/div/div/div[3]/div[5]/div[2]/div[3]/div/div[2]/
div[2]/a'))).click()
But both methods couldn't hit the "SHOW NEXT 24" button. I believe error 403-forbidden doesn't let me load more products.
Here is the screenshot of the tag:

Any tip or solution will be very appreciated. Thanks in advance.