Micro Focus QTP (UFT) Forums

Full Version: Verify that a dropdown Element is in Readonly mode with QTP.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to verify a dropdown value is in Read only mode using QTP?

Here in my application there is a dropdownlist whose value is set to "Yes" as per the Test cases.

Now after submitting the form that consists that dropdown , we have to open the form again(via any link that has stored in some inventory) and have to check that the dropdown exists and its value is set to "Yes" and it is no more editable.(read-only mode)

But at the time of opening the form back again we found that , it is no more dropdown list element, rather than it is a webelement. And I checked the GetRoProperties too, but did not find any suitable property to verify that.

So now what should the appropriate way to verify such scenario?

Can anyone please help me out with their knowledge?


Regards,
Nilanjan.


Could you please paste the snapshot of object spy for that object?
Okay...Go ahead with the validation. If it is no more a weblist, dont worry abt it. Check whether it is a webelement or not instead. Usually Webelemts are read only/static values only. So you can validate this.
Do post if you find any alternate solution for this.
Yes..I just thought that only..as it is webelement so it is supposed to be in read-only mode.
Still added that web-element in the repository (shared), and took the "innertext" and "outertext" via getROProperty and stored in two variables.

And then checked as both are "Yes", so proper value got saved and in read-only mode.

Please let me know if u found any better.

Thanks,
Nilanjan.
One alternate way would be using the error handling method.

You can try to set the value in the object. and check for error. If any error is thrown, the object is read only.
Code:
On Error Resume Next
Browser("").Page("").WebElement("").Object.text=<Some Value>
IF Err.Number<>0 Then
msgbox "Object is read only"
Else
msgbox "Values set successfully"
End If

You can try the above method.

Regards,
Ankesh
Hi Ankesh,

Sorry for being reply ,checked this bit late. Your solutions seems the better one.

Verified it on my application and it worked fine.

Thanks for your help.

Regards,
Nilanjan.