My Blog List

Thursday, February 23, 2012

QTP - Patches

You can download different patches released for hot fixes for QTP 10 and 11 from here.
http://www.joecolantonio.com/downloads/

WebDriver - Rare Tips I

1. MouseHover using WebDriver
actions.MoveToElement(element).Click().Build().Perform();

2. ChromeDriver Usage
Don't forget to include the ChromeDriver.exe before executing webdriver script.
  1. System.setProperty("webdriver.chrome.driver", "c:\\selenium_downloads\\google_driver\\chromedriver.exe");
  2. WebDriver driver = new ChromeDriver();
  3. driver.get("http://www.google.com");
You can look more info from here.
https://code.google.com/p/selenium/wiki/ChromeDriver


3. Set to trust all SecurityCertificates
  1. RemoteControlConfiguration rcc = new RemoteControlConfiguration ();
  2. rcc.setTrustAllSSLCertificates(true);
  3. SeleniumServer seleniumserver=new SeleniumServer(rcc);
  4. seleniumserver.boot();
  5. seleniumserver.start();
  6. setUp("https://www.google.com/", "*firefox");
  7. selenium.open("/");


Also you can avoid SSL problems using firefox profiles.
1. When you start Selenium RC Server, you can ask it to use a particular Firefox Profile as following:
  1. java -jar selenium-server2.jar -firefoxProfileTemplate "C:\Users\XXXXXXX\AppData\Roaming\Mozilla\Firefox\Profiles\ab815bdy.Selenium"

FF allows to Trust certain website, and never prompt you again. So, you create this profile first, then ask Selenium to use this FF Profile.

Saturday, February 18, 2012

JavaScript - Overview

Recently I have attended a session on JavaScript basics and very eager to know something we don't know. I am here to discuss some points about JavaScript.

-- Basically JavaScript is an Object-Oriented Scripting Language but no relation with Java. Only name have relation.
-- Engineer from Netscape company created Scripting Language "Mocha" for their browser Netscape Navigator. Then renamed as LiveScript.
-- Then Microsoft created their implementation of Scripting Language for their browser and named as JScript for IE.
-- Then ECMA(European Computers Manufacturers Association) took and standardized as ECMA Script. But for marketing purpose they named as JavaScript because Java is familiar in the world.
-- We can also create classes using Prototypes like

  1. function myClass(){
  2.     //some definition
  3. }
  4.  
  5. myClass.prototype.function = myFunc1() {
  6.     // Some function definition
  7. }
-- Dynamic variable types - No static types of variables. All are variants here. No need to worry about variable types.
-- Anonymous functions ie. Assigning a function definition to a variable without function name.
  1. var myVariable = function() {
  2.    //some definition
  3. }
-- Closures - Nested functions. Inner function will access the outer function's details but Outer function can't access inner function's details.
-- The Scripts are executed by JavaScript engine provided by respective browsers.
    IE - Chakra
    Mozilla - TraceMonkey, JagerMonkey
    Chrome - V8 engine
    Safari - Nitro
-- These Engines are called as Interpreter OR you can take it as JavaScript Virtual Machine.

Hope this will give idea about JavaScript. I will continue this post later....

Friday, February 3, 2012

Best Practices for QTP Tool

Recently saw some good tips to improve the QTP execution in best way with good performance. Here I am sharing those ideas.
1. Always try to use Sync or Exist(2) instead of Wait
2. Always specify parameter for Exist otherwise it will wait up to default timeout value.
3. Use Option Explicit to force use of variables by declaring as it fasten the script execution.
4. Load only required add-ins at start-up.
5. Use Automation  Object Model(AOM) to automate QTP execution process.
6. Run in Fast execution mode while executing full scripts.
7. Try to avoid Smart Identification feature.
8. Disable Video recording, Active Screens etc unless you required.
9. Always nullify the objects which are used in scripts.
10. Always try to use variables to store test objects and then do operations from that assigned variable instead of doing it in single object hierarchy line. This will fasten the execution.
  1. //Use Like this,
  2. Dim NameText, PassText
  3. Set NameText = Window("main").Window("sub panel").Dialog("Login").WinEdit("Name")
  4. NameText.Set "username"
  5.  
  6. //Try to avoid like this,
  7. Window("main").Window("sub panel").Dialog("Login").WinEdit("Name").Set "username"
11. Try to Use With statements
12. Try to minimize the Object Repository file size. Do not keep unwanted test objects in OR.
13. Finally, Use good amount of RAM in computers as QTP will take some amount of RAM while running.