0

Can anyone provide me the Selenium Java Code (TestNG framework) for Bold appearance of text shown on a webpage .I am using Selenium RC to execute my testcases ,and i use Eclipse for selenium testscript preparation in java.

Virendra Joshi
  • 469
  • 4
  • 8
  • 25
  • Is there a possible solution by using CSS selectors , because CSS styles are not shown in HTML of the elements I am trying to test. – Virendra Joshi Aug 31 '12 at 07:32

1 Answers1

0

This code lists all the elements with bold text in the current page. (The code assumes that WebDriver is defined to "driver".)

List<WebElement> temps =  driver.findElements( By.cssSelector("*") );
for( int i=0; i<temps.size(); i++ ) {
  if( temps.get(i).getCssValue("font-weight").equals( Integer.toString(700) ) ) {
    System.out.println(temps.get(i).getText());
  }
}
roncsak
  • 618
  • 1
  • 8
  • 21