Reputation: 71
HTML Code:-
< label ng-if="menuItem.titleColor"
ng-style="{'color':menuItem.titleColor}" style="text-align: center; font-weight: normal; color: rgb(255, 255, 255);" class="ng-binding ng-scope">
Group
< /label>
Selenium Code:-
String locatorg = "//label";
By findBytextg = By.xpath(locatorg);
System.out.print(findBytextg.toString());
How to Print All Property in Selenium Console in Eclipse?????
Upvotes: 2
Views: 1591
Reputation: 1761
If I understand your request correctly, you wish to print out the HTML element with all of its attributes. You can use the 'outerHTML' attribute on the element to do that. Note that you'll need to access the element first. My Java is a little rusty, but you can try this:
String locatorg = "//label";
By findBytextg = By.xpath(locatorg);
webelement labelElement = driver.findElement(findBytextg);
System.out.print(labelElement.getAttribute('outerHTML'));
Upvotes: 3