I have developed a program that crawls through various web pages and conducts tests using Selenium. My current task is to identify which CSS Frameworks are utilized on these websites for statistical analysis. Currently, I am using the FireFox Webdriver to check if there are any .css files linked in the page with specific framework names:
Iterator<WebElement> divWebElementIteratorCSS = webDriver.findElements(By.xpath("//link[@rel='stylesheet']")).iterator();
After locating the .css files, I then verify if the name of the file contains one of the CSS Frameworks I intend to analyze:
if ( src.contains( frameWorkName ) && cssFrameWorks.get( frameWorkName ) == false ) {
result.addAttribute("Framework", "STRING", frameWorkName);
result.setPercent( 100 );
result.setSuccessful( true );
cssFrameWorks.put( frameWorkName, true );
}
The HashMap 'frameWorkName' stores all the relevant framework names.
However, I am facing an issue: If the site administrator changes the name of the framework's .css file, my test fails! Is there a foolproof method to address this, ensuring that the test works regardless of the filename?