Friday, 9 August 2013

How to Capture Screen Shot on All Test Failures in Selenium

Code to take screen shot in Selenium using python -
#!/usr/bin/env python
from selenium import webdriver
browser = webdriver.Firefox()
browser.get(’http://www.google.com/’)
browser.save_screenshot(’screenie.png’)
browser.quit()

How to Delete/create Folder Through LoadRunner Script

if (rmdir(new_dir) == 0)
lr_output_message (”Removed new directory %s”, new_dir);
else
lr_output_message (”Unable to remove %s error %d”, new_dir);

How to Know Start Time, End Time and Total Execution Time of QTP Script

x = StartTimer() at the beginning of script
y = EndTimer() at the End of script
Then Total Time to execute will be
Time Taken = y – x

Start Time,End Time and Total Time of Script Execution in HP QTP


On the task bar of QTP, there are two clock icons. One of the icons is for Start transaction timing and the other for End transaction. Click in the code where you want to start the timing and click the Start transaction timing. Then click at the place in the code where you want to end the timing

and click the End transaction timing icon. At this point you will have your start and end timings. subtract the Start timing from the End timing and will have time it took to complete that portion of the code.

Create a HTML Page for QTP Script Code

Use [Dreamweaver Application] – Put code in HTML body tag so that it can be displayed to client.