I'm trying to create a dynamic "element map" of the elements displayed inside a banner menu including the link displayed for each menu.
This map will be stored inside a String[][]
matrix, which will be used for different methods and tests.
To do that I get the element's href
attribute and create my own CSS selector for each link displayed in the menus. This is my the code to create the CSS:
CSS = (String)element.getAttribute("href").subSequence((element.getAttribute("href").length()-20), element.getAttribute("href").length());
CSS="a[href*='" + CSS +"']";
That works pretty well, but I have some links that run some JavaScript code and I cannot create the CSS selector for them.
Is there any onther way to get the CSS selector from a WebElement? Using Firebug I can get the CSS path. Could I get this CSS path during the execution having the WebElement? Any other suggestions?