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')]")
https://stackoverflow.com/questions/66827403/how-to-find-a-web-element-in-selenium-that-contains-a-text-using-python March 27, 2021 at 10:08AM
没有评论:
发表评论