title: How do i move to 2nd page after scraping first in python
body: <p>I am trying to scrape products details from aliexpress. I have 2 questions. First, how do I scrape category and save it in csv file in front of each product and second, how do I move to the 2nd and other pages until there are no more pages available or until page 10.</p>
  
  <p>This is the code I have written to find the next pages</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import requests as r
  
  page = r.get('https://www.aliexpress.com/category/200000664/jackets.html?spm=2114.11010108.102.4.650c649b8lfPOb')
  soup = BeautifulSoup(page.content,'html.parser')
  
  content = soup.find(id="pagination-bottom")
  
  pages = content.findAll('a')
  
  for i in pages:
      print('https:' + i.get('href'))
  
  from selenium import webdriver 
  from selenium.webdriver.support.ui import WebDriverWait 
  from selenium.webdriver.support import expected_conditions as EC 
  from selenium.webdriver.common.by import By
  from selenium.common.exceptions import TimeoutException
  
  from bs4 import BeautifulSoup import urllib.request 
  
  filename = "alibaba.csv" 
  f=open(filename, "w")
  
  headers="product_name, price, Rating \n" 
  f.write(headers)
  
  
  class alibabascrape(object):
      def __init__(self, keyword):
          self.keyword = keyword
  
          self.url = f"https://www.aliexpress.com/wholesale?catId=0&amp;initiative_id=&amp;SearchText={keyword}"
  
          self.driver = webdriver.Firefox(executable_path = 'c:\geckodriver.exe')
          self.delay = 3
  
      def load_alibabalist_url(self):
          self.driver.get(self.url)
          try:
              wait = WebDriverWait(self.driver, self.delay)
              wait.until(EC.presence_of_all_elements_located((By.ID, "form-searchbar")))
              print("page is ready")
          except TimeoutException:
              print("Too much Time")
  
      def extract_post_information(self):
          all_posts = self.driver.find_elements_by_class_name("list-item")
          post_title_list = []
          for post in all_posts:
              title=post.text.split("\n")
              name=title[0]
              print(name)
              price=title[2]
              print(price)
              rating = title[6]
              print(rating)
              f.write(name + "," + price + "," + rating + "\n")
              post_title_list.append(post.text)
  
          return post_title_list
  
  
  
      def extract_category(self):
          category = self.driver.find_elements_by_class_name("col-sub")
          print(category)
  
  
      def extract_post_urls(self):
          url_list = []
          html_page = urllib.request.urlopen(self.url)
          soup = BeautifulSoup(html_page, "lxml")
          for link in soup.findAll("a", {"class": "history-item product"}):
              print(link["href"])
              url_list.append(link["href"])
          return url_list
  
  
  keyword = "iphone"
  scrapper = alibabascrape(keyword)
  scrapper.load_alibabalist_url()
  scrapper.extract_post_information()
  scrapper.extract_category()
  scrapper.extract_post_urls()
  </code></pre>