I was curious if there was a way to find an element using Selenium and Python 2.7 by multiple "keywords" in any order. Allow me to explain using an example:
keyword1 = raw_input("Keyword: ").lower().title()
keyword2 = raw_input("Keyword: ").lower().title()
try :
clickOnProduct = "driver.find_element_by_xpath(\"//*[contains(text(), '" + keyword1 + "')]\").click()"
exec(clickOnProduct)
This is just a snippet of the code, but how could I incorporate this to look for an element that contains both of these keywords (keyword1, keyword2) in any order? It sounds easy in principle and it probably is, but I am having a hell of a time trying to get this. Any suggestions would be greatly appreciated, thanks.