The application I am testing searches for an account based on the email ID. The email ID is unique. The result gets displayed in the form of a table with various columns. One of which is "Account Name" displaying the name of the user/account holder linked to the email address in question. In order to go into the account, one has to click on this "Account Name" value which is a link. This "Account Name" link is dynamic based on the email ID we use every time. On inspecting this link I get this:
<a href="/001m000000pFY6U?srPos=0&srKp=001" data-seclke="Account" data-seclkh="60761f49cf4ed8788252c560b733bef0" data- seclki="001m000000pFY6U" data-seclkp="/001m000000pFY6U" data-seclkr="1" onmousedown="searchResultClick.mousedown(this, event)" xpath="1" style="">F John</a>
I am wondering if there is a way to retrieve/extract only the
href="/001m000000pFY6U?srPos=0&srKp=001" bit from the above.
I tried the following:
elem = self.driver.find_elements_by_xpath("//a[@href]")
print(elem)
and this prints 120 lines something similar to the following: selenium.webdriver.remote.webelement.WebElement (session="502b43c903be36c997d4882f26f3c7ad",element="0.4252537892711272- 1")
Would appreciate a little help. Thanks.