Trying to locate an href that contains text

python, selenium

Solution

You can find the element by `xpath`:

text = "example@example.com"  
element = driver.find_element_by_xpath('//a[contains(@href, "%s")]' % text)

Problem

I am very new to coding - We are using Selenium with python scripting. Please find the attached screen shot for the HMTL of my page. The actual web page is a table that has "x" for all the user accounts. I am trying to locate the href attribute that contains a user account that I pass as variable.(In the below example I am trying to click on the link that has "expample@exampleemail.com" ) Can someone please help me locating the element. Thanks!

Original source

Related problems