Oct
12
2008
--

“The parameter is incorrect” error when typing into a WebEdit

Sometimes QTP throws a “The parameter is incorrect” error when setting a text in a WebEdit

The parameter is incorrect error

The parameter is incorrect error

Below is a test textbox to reproduce the issue

WebEdit with Max Length 4:

The error can be reproduced using below code

'Will work fine
Browser("KnowledgeInbox").Page("KnowledgeInbox").WebEdit("txtMaxTest").Set "1234"
 
'Will throw a parameter is incorrect error
Browser("KnowledgeInbox").Page("KnowledgeInbox").WebEdit("txtMaxTest").Set "12345"

There are two root causes of this issue

Root Cause #1
Trying to set a text in a textbox greater than it’s max length would raise the error. The sample textbox shown in this article has Max length of 4. That is the reason why the 2nd line of the code shown above throws an error

Root Cause #2
This root cause is specific to firefox browser. If ReplayType (in Tools->Options->Web (Tab) -> Advacned…(button)) is set to Mouse then an set operation on a WebEdit in Firefox will produce this error. The code below can be used to reproduce the error

'Will work fine
Setting.WebPackage("ReplayType") = 1 'Browser
Browser("KnowledgeInbox").Page("KnowledgeInbox").WebEdit("txtMaxTest").Set "1234"
 
Setting.WebPackage("ReplayType") = 2 'Mouse
'Will throw a parameter is incorrect error even when we type the same text
Browser("KnowledgeInbox").Page("KnowledgeInbox").WebEdit("txtMaxTest").Set "1234"
Rating: 8.9/10 (15 votes cast)
Sep
24
2008
--

General run error when clicking on button

General run error are hard to debug and any extra information available to fix the issue is always helpful. Sometimes QTP starts throwing General run error in click events of WebButton. Digging into the source of the issue using the technique mentioned in Debugging General run error we would see a “Element not found” error in the debug pane.

When you check exist on the button it would still return True but the click would throw a general run error. I have not been to formalize what causes this issue but there is a small dirty workaround to fix

Browser("Browser").Page("Page").WebButton("Login").Highlight
Browser("Browser").Page("Page").WebButton("Login").Click

Note: You should only use this workaround in case you are getting a general run error. This should never be used as a practice

Rating: 7.1/10 (7 votes cast)
Sep
21
2008
0

WebFile incosistent errors

This issue is one of the very strange one that happens sometimes and works sometimes. So you have a line of code setting the file path in a WebFile element

Browser("B").Page("P").WebFile("F").Set "C:\Test.txt"
Browser("B").Page("P").WebButton("Upload").Click

Above code might work fine sometimes, but few times you might find your web application throwing an error ex - “File not found”. I am not very sure what causes this issue but there are three possible solutions I could find for above issues

Solution #1

Highlighting the WebFile object before setting the value sometimes helps

Browser("B").Page("P").WebFile("F").Highlight
Browser("B").Page("P").WebFile("F").Set "C:\Test.txt"
Browser("B").Page("P").WebButton("Upload").Click

Solution #2

Changing the ReplayType to 2 also can help in certain cases

Setting.WebPackage("ReplayType").Click
Browser("B").Page("P").WebFile("F").Set "C:\Test.txt"
Browser("B").Page("P").WebButton("Upload").Click

Solution #3

This one is a bit tricky one and the way it works is that it use the Browser button to select the actual file

Function SetWebFile(oWebFile, oBrw, sFileText)
	x = oWebFile.Object.clientHeight \ 2
	y = oWebFile.Object.clientWidth - 5
 
	oWebFile.Click x,y
	oBrw.Dialog("text:=Choose file") _
			.WinEdit("attachedtext:=File &name:","nativeclass:=Edit") _
			.Set "c:\comp1.xml"
 
	oBrw.Dialog("text:=Choose file").WinButton("text:=&Open").Click
End Function
 
Call SetWebFile(Browser("B").Page("P").WebFile("F"), Browser("B"), "C:\Test.txt")
Rating: 10.0/10 (1 vote cast)
Sep
21
2008
0

Internet explorer replay issue

There are times when below Navigate statement in QTP runs fine but does not Navigate to the actual website

Browser("XXX").Navigate "http://www.knowledgeinbox.com"

Now there can be different possible root cause for this issue. This article will take you throw most of them one by one

Possible Root Cause #1

There is a child modal dialog in IE waiting for user action. The below script in QTP demonstrates how to recreate this issue

'Create a modal dialog on IE window
Browser("Browser").Navigate "javascript:void(alert('Test dialog'))"
 
'Below navigate would be execute without error but
'the actual website will not be browsed.
'In our case we raise the dialog box using javascript
'navigation but in real world scenario this could be
'a security dialog popup or someother popup
Browser("Browser").Navigate "www.knowledgeinbox.com"
IE Modal dialog

IE Modal dialog

The test results window won’t show any error for the 2nd Navigate line

Test results summary without error

Test results summary without error

Possible Root Cause #2

QTP “BHOManager Class” Add-on is disabled in IE. This BHO manager allows QTP to interact with IE window and perform operations inside it. To check the status of the same, open a new IE window and go to Tools->Manage Add-ons…

IE Manage Add-ons

IE Manage Add-ons

In case the BHOManager Class Add-on is disabled, enabled it and close all open IE windows. This will fix the navigate issue.

Possible Root Cause #3

Another mysterious root cause can be because of corruption of the windows user profile. Though it is unknown what gets corrupted in the profile but the solution to this is to delete your profile and create a new one.

Trying to delete a user profile just in hope that it would make things work is not something anyone would try to do first. But to make sure that deleting the profile would help you can first login to the system with a different user who has never used that system and after that verify if the Navigate statements are working in QTP.

Possible Root Cause #4

QTP DLL registration information in registry is corrupted. To repair all the DLL registry run the below file from run window

%ProgramFiles%\Mercury Interactive\QuickTest Professional\bin\quickTestProfessional.bat

Run QuickTestProffesional.bat

Run QuickTestProffesional.bat

Note: This works for QTP 9.2 or lower versions only. With QTP 9.5 HP has removed these files

Possible Root Cause #5

If you had a recent upgrade from IE6 to IE7, the upgrade might be causing the issue. Try and uninstall IE7 and see if it helps. Also if you are using QTP9.x (Except 9.5) make sure you have Tabbed browsing disabled

Possible Root Cause #6

IE7 introduce a new security featured named protected mode. When protected mode is enabled IE process runs with very low privileges. This can cause recording as well as replay issues for a QTP script. Disable the the protected mode by editing the security zone

Disable IE protected moded

Disable IE protected moded

Possible Root Cause #7

User Access control (UAC) is enabled on the Windows vista machine. Go to control panel and make sure UAC checkbox is cleared

Disable User Access control (UAC)

Disable User Access control (UAC)

Possible Root Cause #8

Another possible root cause is that complete QTP installation is corrupt and needs to be repaired. To do that follow the below mentioned step

  • Uninstall QTP from control panel
  • Restart the system
  • Clean the system registry using QTP Clean Uninstall tool
  • Restart the system
  • Reinstall QTP

Possible Root Cause #9

This is something that I would never check until unless it is very important to get IE working on the same machine only. The possible root cause could be a corrupted OS. You should consider getting your machine rebuilt by asking the System administrator

Rating: 9.0/10 (1 vote cast)
Sep
21
2008
0

VLS Errors on QTP startup

Sometimes when QTP is launched it starts throwing some funny error messages like VLSErrorHandle(0), VLSsetBroadcastInterval( 10 ) as shown in the images below

VLS Error message

VLS Error message

Resolution:

This issue occurs when QTP license manager (IMO) tries to write a log file to the Temp directory and QTP does not have access to the same. In my case just to demonstrate the error I changed the Windows Environment variable TMP and TEMP to an invalid directory “C:\TEM” as shown below

Windows environment variables

Windows environment variables

To view Environment variable follow the below mentioned steps

  • Right click on My Computer and choose Properties

    My computer properties

    My computer properties

  • Browse to the Advanced Tab and click on Environment Variables button

    System Properties - Advanced tab

    System Properties - Advanced tab

  • Look at the User variables for current user and change the TEMP and TMP to a valid directory

    Edit Temp environment variable

    Edit Temp environment variable

Now start QTP and the error message would be gone

Rating: 9.8/10 (4 votes cast)