I'm trying to create a program that clicks on boxes that contain a certain word, however all of the boxes have other words around them.
For example the site has a bunch of recipes, however I just want the ones that contain the word "soup". So it needs to be able to click on text that say, "tomato soup, "yummy soup", "some other soup type soup", and so on.
I've found this line.
WebDriverWait(driver, 10).until(expected_conditions.element_to_be_clickable((By.XPATH, "//span[text()='Soup']"))).click()
which is great but only works if you put the exact text in it.
Ex. WebDriverWait(driver, 10).until(expected_conditions.element_to_be_clickable((By.XPATH, "//span[text()='Tomato Soup']"))).click()
If anyone knows how to do a more loose find that would be a big help. Thank You.