I'm trying to go through this site "https://www.dream11.com/cricket/create-team/1278/17702" and once this site is loaded, I want to click the skip button (which I can do) and then go on each of the individual tabs "WK", "BAT", "AR" and "Bowl" and click them and then scrape data from them once they are clicked.
But I can't seem to figure out any way of clicking the individual tabs using find_element_by_xpath, when I've tried various different class settings and still can't figure out.
I know another way would be to actively move the mouse to find the coordinates or to do a search by image but was wondering if there was a simpler way or if I was missing anything basic.
Here's the code I have currently.
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import urllib
option=webdriver.ChromeOptions()
option.add_argument(" - incognito")
browser = webdriver.Chrome(executable_path=r'C:/Users/mohammadh/Downloads/chromedriver', options=option)
browser.get("https://www.dream11.com/cricket/create-team/1278/17702")
timeout=20
try:
items = WebDriverWait(browser, timeout).until(EC.visibility_of_element_located((By.XPATH, "//button[@class='btn btn--flat btn--bordered btn--bordered--white text-color--white']")))
except TimeoutException:
print("Timed out waiting for page to load")
browser.quit()
element = browser.find_element_by_xpath("//div[contains(@class,'spotlight_skip_button spotlightSkipButton_4b62a')]")
element.click()
WK = browser.find_element_by_xpath("//div[contains(@class,'createTeamTabTitle_99a5a')]")
WK.click()
BAT = browser.find_element_by_xpath("//div[contains(@class,'createTeamTabTitle_99a5a')]")
BAT.click()
AR = browser.find_element_by_xpath("//div[contains(@class,'createTeamTabTitle_99a5a')]")
AR.click()
BOWL = browser.find_element_by_xpath("//div[contains(@class,'createTeamTabTitle_99a5a')]")
BOWL.click()
Any help would be greatly appreciated.