Sunday, February 26, 2012

Remote Desktop - Restart the computer

Remote Desktop - Restart the computer.

Generally we run the Selenium or QTP tests on remote systems. Some times you may require to restart the system, but there is no option provided to restart, just you can log-off.

In order to restart the computer, open the command prompt and type shutdown -r
Attaching screen shots for more clarity.


Sunday, February 19, 2012

Schedule Task - shortcut creation

Schedule Task - shortcut creation

Lot of times we use schedule tasks to schedule QTP or Selenium(Webdriver) scripts through ANT. In order to open Schedule Tasks page, need to navigate to control panel and select the schedule task icon.

I was trying to create a shortcut, by using right click but not successful.

Later I came to know that by updating the windows register system will automatically generate the Schedule task shortcut on the desktop.

Follow below steps to update the registry contents.

1. Command prompt, type regedit, this will open Registry editor.
2. Always take backup of the current registry by File-Export to restore any undesired changed.
3. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace
4. Create new key with this value {D6277990-4C6A-11CF-8D87-00AA0060F5BF} as shown in the below screen shot.

5. Exit the Registry editor (No restart required)
6. On the Desktop refresh (F5)
7. You can notice new Schedule task icon as shown below


Friday, February 10, 2012

Webdriver - Retrieve innerHTML

Webdriver - Retrieve innerHTML

I was implementing an assertion for save transaction and was trying to retrieve the text using Gettext(), but not successful, getting null. Below is the HTML layout.

String Status = driver.findElement("spnSuccess")).getText();

Then I have implemented following JavaScript to retrieve the text.

     String script = "return document.getElementById('spnSuccess').innerHTML;";
    String Temp = (String) ((JavascriptExecutor) driver).executeScript(script);
    assertEquals(Temp,"Requisition Saved Successfully");