Building a scraper with selenium in python. Trying to select a number of buttons in sequence that have sequential titles of the form 'Race n' where n is an integer.
I want to be able to do something like:
driver.find_element_by_css_selector("a[title*=race_i]").click()
where the variable race_i = 'Race ' + str(i)
Is it possible to feed the css or xpath lookup a variable, rather than a plain string? The number of buttons varies so I need this function to be adaptable and work for any value of n.