title: How to sort flipkart with selenium python
body: <p>I want to sort flipkart products by popularity but I can't find a way to do it</p>
  <pre><code>&gt;span class=&quot;_2i7N3j&quot;&gt;Sort By&lt;/span\
  &gt;span class=&quot;_2i7N3j&quot;&gt;Relevance&lt;/span\
  &gt;span class=&quot;_2i7N3j&quot;&gt;Popularity&lt;/span 
  </code></pre>
  <p>I want to click popularity</p>
  <p>All the option have same class and no id
  I also tried with link_text but it didn't work
  can someone help</p>
  <p>this is the code I wrote</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  import time
  
  product = input(&quot;Which product review you want: &quot;).lower()
  print(f&quot;Best {product} in your range from famous website&quot;)
  
  PATH = &quot;C:\Program Files (x86)\chromedriver.exe&quot;
  driver = webdriver.Chrome(PATH)
  
  try:
      driver.get(&quot;https://www.flipkart.com/&quot;)
      search = WebDriverWait(driver, 10).until(
          EC.presence_of_element_located((By.NAME,&quot;q&quot;))
      )
      search.send_keys(product)
      search.send_keys(Keys.ENTER)
      pop = WebDriverWait(driver, 10).until(
          EC.presence_of_element_located((By.XPATH(&quot;//div[contains(text(), 'Popularity')]&quot;)))
      )
      pop.click()
      print(driver.current_url)
      time.sleep(2)
  
  finally:
      time.sleep(2)
      driver.quit()
  </code></pre>