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.
Asked
Active
Viewed 347 times
0
-
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 Answers
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
-
-
@Maitreya can u provide the code to be executed by selenium-RC. – Virendra Joshi Sep 04 '12 at 07:29
-
I'm not findig the javadoc for Selenium RC. If you can help me find it, possibly i can help you back. (But in theory, you only need change `driver` to `selenium`.) – roncsak Sep 04 '12 at 08:05