title: Python Selenium Text Convert into Data Frame
body: <p>I have a question in regards to DataFrame. I have written a code with Selenium to extract a table from a website. However, I am having doubt on how to transform the Selenium text into DataFrame and export it in CSV. Below is my code.</p>
  <pre><code>import requests
  import pandas as pd
  from selenium import webdriver
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.common.exceptions import TimeoutException
  from selenium.webdriver.support import expected_conditions as EC
  from selenium.webdriver.common.by import By
  
  driver = webdriver.Chrome(&quot;Path&quot;)
  driver.get(&quot;https://www.bcsc.bc.ca/enforcement/early-intervention/investment-caution-list&quot;)
  table = driver.find_element_by_xpath('//table[@id=&quot;inlineSearchTable&quot;]/tbody')
  
  while True:
      try:
          print(table.text)
          WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, &quot;//a[@class='paginate_button next']&quot;))).click()
          time.sleep(1)
  
      except:
          WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, &quot;//a[@class='paginate_button next disabled']&quot;))).click()
          break
  
  driver.quit()
  </code></pre>