So the problem statement is:

I need to store a specific number(marked in RED) from the attribute & for that I want to point to that number in an xPath. Is that possible? enter image description here


You need to get the innerHTML via getAttribute("onmouseover") function and parse the String using a regular expression. There is no direct approach from Selenium.


You can ask for a link tag which contains some substring in its onmouseover attribute.

//a[contains(@onmouseover, '338792')]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.