I am trying to find a matching text on a page with Selenium, but I am not sure how to make it read an input string from a variable. For example:
video_title = 'Michael Jackson - Thriller'
driver.find_elements_by_xpath("//*[contains(text(), video_title)]")
The code above does not give me good results, as it probably searches literary for "video_title", and not the string inside. I omited the standard quotes arround video_title in the code above, in hopes of Selenium looking at it as a variable, but it doesn't seem to work.
Is this possible to do? With Selenium, or some other way? Thanks!