I want to find a web element that contains text 'My' .But the text is stored in a variable named msg
msg = "My"
How do I use the variable in the xpath and find the web element . I also want to click the element
below code works if I give the text directly in the xpath . But i want to use the variable msg to generalize
driver.find_elements_by_xpath("//*[contains(text(), 'My')]")