Web Performance Report Using Y-Slow Tool along with Selenium

Web page performance and its causes can be monitored by using Y-slow, a tool which analyses web pages and using a set of rules provides suggestions on how to improve the web page performance.

Manually setting preferences for Y-slow: 

  • Open Firefox browser and type about:config
  • Search for Y-slow and set the below preferences:extensions.yslow.beaconUrl = http://www.showslow.com/beacon/yslow/
    extensions.yslow.beaconInfo = grade
    extensions.yslow.optinBeacon = true
    extensions.yslow.autorun = true

  • Now open the Firefox browser and navigate to any web page.
  • Open “http://www.showslow.com” and move to the page under “Last Measurements” tab.
  • The URL for your web application and the Y-slow grade would be present in the table. Click on the URL to view the report of your web page.

Setting preferences from Selenium:

  • Add the .xpi file for Y-slow.
    File yslow = new File(“Path to:\\yslow@yahoo-inc.com.xpi“);
  • Create a firefox profile.
    FirefoxProfile profile = new FirefoxProfile();
  • Add the firebug extension.
    profile.addExtension(firebug);
  • Add the firebug preferences.
    profile.setPreference(“extensions.firebug.currentVersion”, “2.0”);
    profile.setPreference(“extensions.firebug.addonBarOpened”, true);
    profile.setPreference(“extensions.firebug.console.enableSites”, true);
    profile.setPreference(“extensions.firebug.script.enableSites”, true);
    profile.setPreference(“extensions.firebug.net.enableSites”, true);
    profile.setPreference(“extensions.firebug.previousPlacement”, 1);
    profile.setPreference(“extensions.firebug.allPagesActivation”, “on”);
    profile.setPreference(“extensions.firebug.onByDefault”, true);
    profile.setPreference(“extensions.firebug.defaultPanelName”, “net”);
  • Add the yslow extension.
    profile.addExtension(yslow);
  • Then set the yslow preferences.
    profile.setPreference(“extensions.yslow.beaconUrl”,     “http://www.showslow.com/beacon/yslow/ “);
    profile.setPreference(“extensions.yslow.beaconInfo”,”grade”);
    profile.setPreference(“extensions.yslow.optinBeacon”,true);
    profile.setPreference(“extensions.yslow.autorun”,true);
  • Add the capabilities.
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setBrowserName(“firefox”);
    capabilities.setPlatform(org.openqa.selenium.Platform.ANY);
    capabilities.setCapability(FirefoxDriver.PROFILE, profile);
    WebDriver driver = new FirefoxDriver(capabilities);
  • Navigate to your application web page using selenium.
  • Open “http://www.showslow.com” and move to the page under “Last Measurements” tab for the reports.

 

Written By: – Jaya Mohanty, QA Engineer, Mindfire Solutions

Advertisements

Posted on April 8, 2014, in Automation Testing, Performance Testing, Selenium Testing and tagged , , , , , , , , , , , , , , , . Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: