for each currency pair download the data fr all months using  by setting the vlaue to value="Exness_XAUUSDm_2024.zip" fir this element: <input name="month" aria-hidden="true" tabindex="-1" class="MuiSelect-nativeInput mui-1k3x8v3" value="Exness_XAUUSDm_2024.zip"> relevant xpath: /html/body/div[1]/div[1]/div/main/section[2]/div/div/div[4]/div/div/input current script :from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service as ChromeService  # Use FirefoxService for Firefox
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import time

# Configuration
URL = "https://www.exness.global/tick-history/"  # Replace with the actual URL
INPUT_XPATH = '//*[@id="instrument"]'
ARROW_DOWN_KEYS = 1  # Number of times to press Arrow Down


def main():
    # Initialize WebDriver (Chrome in this example)


# Initialize the WebDriver (example with Chrome)
    driver = webdriver.Chrome()

    try:
        # Navigate to the specified URL
        driver.get(URL)

        # Initialize WebDriverWait
        wait = WebDriverWait(driver, 10)

        # Wait until the input element is clickable
        instrument_input = wait.until(
            EC.element_to_be_clickable((By.XPATH, INPUT_XPATH))
        )

        # Click on the input to activate the dropdown/autocomplete
        instrument_input.click()
        print("Clicked on the input field.")

        # Wait until the dropdown is expanded by checking 'aria-expanded' attribute
        wait.until(
            lambda d: d.find_element(By.XPATH, INPUT_XPATH).get_attribute('aria-expanded') == 'true'
        )
        print("Dropdown is expanded.")

        # Iterate through the options by sending Arrow Down keys
        for i in range(ARROW_DOWN_KEYS):
            instrument_input.send_keys(Keys.ARROW_DOWN)
            time.sleep(0.5)  # Wait for the UI to update

            # Retrieve the current 'aria-activedescendant' value
            aria_active = instrument_input.get_attribute('aria-activedescendant')
            if aria_active:
                print(f"Step {i+1}: aria-activedescendant = {aria_active}")
                
                # Optionally, retrieve the text of the active option
                try:
                    active_option = driver.find_element(By.ID, aria_active)
                    print(f"Active Option Text: {active_option.text}")
                except Exception as e:
                    print(f"Could not locate active option with ID '{aria_active}': {e}")
            else:
                print(f"Step {i+1}: No active descendant found.")

        # Optionally, select the currently active option by pressing Enter
        instrument_input.send_keys(Keys.ENTER)
        print("Pressed Enter to select the active option.")

        # Additional actions can be performed here after selection

    except TimeoutException:
        print("Timed out waiting for elements to load.")
    except Exception as e:
        print(f"An error occurred: {e}")
    finally:
        # Wait for a few seconds before closing to observe actions (optional)
        time.sleep(5)
        driver.quit()
        print("Browser closed.")

if __name__ == "__main__":
    main()