Unable to select CS:GO from dropdownlist named pro lists using selenium

There is a table which is dynamic and to get that table, need to click on CS:GO from dropdownlist named PRO LISTS. I tried but I ‘m unable to select the correct locator. Thanks.

URL

I tried the following ways:

#driver.find_element_by_xpath('(//i[@class="x-anchor-sub-indicator"])[1]').click()
        #time.sleep(5)
        WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '(//*[@class="sub-menu x-dropdown x-active"]/li/a)[1]'))).click()
        driver.execute_script("arguments[0].click();", driver.find_element_by_xpath('(.//*[@class="sub-menu x-dropdown x-active"]/li/a)[1]/div/div/span'))

updated:

import scrapy
from scrapy.selector import Selector
from scrapy_selenium import SeleniumRequest
from selenium.webdriver.common.keys import Keys
import time

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains


class DropdownScrollTable(scrapy.Spider):
    name = 'dst'

    def start_requests(self):
        yield SeleniumRequest(
            url='https://prosettings.net/cs-go-pro-settings-gear-list/',
            wait_time=5,
            screenshot=True,
            callback=self.parse)

    def parse(self, response):

        driver = response.meta['driver']
        wait = WebDriverWait(driver, 20)
        ActionChains(driver).move_to_element(wait.until(EC.visibility_of_element_located((By.XPATH, "//span[contains(text(),'Pro Lists')]/ancestor::a")))).pause(5).perform()
        wait.until(EC.visibility_of_element_located((By.XPATH, "//span[contains(text(),'CS:GO')]/ancestor::a"))).click()
        
        driver.save_screenshot('search_result.png')

Answer

Things to be noted down :

  1. We need to hover on Pro list, so we will use ActionChains for that.
  2. As soon as we hover, we get to see a list of options, and the first element is CS:GO
  3. Launch browser in full screen mode.
  4. Use explicit waits to let web elements rendered properly.

Code

driver = webdriver.Chrome(driver_path)
driver.maximize_window()
#driver.implicitly_wait(50)
driver.get("https://prosettings.net/cs-go-pro-settings-gear-list/");
wait = WebDriverWait(driver, 20)
ActionChains(driver).move_to_element(wait.until(EC.visibility_of_element_located((By.XPATH, "//span[contains(text(),'Pro Lists')]/ancestor::a")))).pause(5).perform()
wait.until(EC.visibility_of_element_located((By.XPATH, "//span[contains(text(),'CS:GO')]/ancestor::a"))).click()

Imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains