Not able to select option in Web list

731 views
Skip to first unread message

Aneel

unread,
Jan 11, 2014, 7:46:16 AM1/11/14
to mercu...@googlegroups.com
Hi All Experts,


I am facing one problem while working on web based MS CRM 2013 Application.

I am able to select the option in weblist but after selection that option is not listed as selected option in weblist.
Below code selects the option
Browser("").Page("").Frame("").WebList("Lst_ColorCode").Select "Green"

And after that it is not display as selected option in weblist.

I tried with sendkey {ENTER} also but not getting any success

I am using QTP 9.5 , refer the attached screen shot.

Please help


Thanks and Regards,
Aneel
Screenshot 1 for post.png

Prakash Maurya

unread,
Jan 12, 2014, 4:54:57 AM1/12/14
to mercu...@googlegroups.com
Hi Aneel,

Try to spy the values displayed in the drop down list..like "Green", "Blue", i guess they will be coming as 'WebElement' instead of WebList. In this case you have to add these objects/colors in your object repository and then 1st click on web-list and than click on the color/WebElement you want to select.

Thanks & Regards,
Prakash Maurya

QTP Tutorialnet

unread,
Jan 12, 2014, 7:34:49 PM1/12/14
to mercu...@googlegroups.com
Hello,
Do you have a url for us to see this application?
Also, I am not fully clear about the problem. Are you saying that you are able to highlight the value, but not fully able to select it? If this is the case, how do you know that it's not selected? I mean, maybe the dropdown menu is just not collapsing back?

aneel pal

unread,
Jan 14, 2014, 10:33:31 AM1/14/14
to mercu...@googlegroups.com

Hi Prakash,

Items are not coming as "WebElement" , For reference I am attaching Screen Shot (Spy) ,

Please Suggest me any other way .

Thanks And Regards
Aneel


--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
 
---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

aneel pal

unread,
Jan 14, 2014, 10:40:54 AM1/14/14
to mercu...@googlegroups.com
Hi QTP Tutorialnet,

This application is accessible only in organization.

I used below code to see that item is selected and in response of execution I am populating the value in msgbox
Line No.1 :     Browser().Page().Frame().Weblist().Selected "Blue"
Line No.2 :     A = Browser().Page().Frame().Weblist().GetROProperty("Selection")
Line No.3 :     MsgBox A

I am getting selected value in Msgbox  i.e. "Blue"

But When I observed the WebList I got selected option is not displayed in weblist.

Thanks
Anil Kumar Paal









--

Kishor Kumar

unread,
Jan 14, 2014, 10:45:14 AM1/14/14
to mercuryqtp
Hi Aneel,
the control (weblist is presented in WebTable), so find out the row and column where the weblist exist in a table
then use child item () to get reference like below

assume weblist exist in Row2 , column 3. then

Set RefList=Br().p().Webtable().childItem(row,col,"WebList",0)

RefList.select "#1"

Ravi kiran

unread,
Jan 14, 2014, 11:04:00 AM1/14/14
to mercu...@googlegroups.com
i faced same issue. can you try using fire event with mouse click

aneel pal

unread,
Jan 14, 2014, 1:36:03 PM1/14/14
to mercu...@googlegroups.com
Hi Ravi,

I used fireevent for mouse click and Double click and sendkeys method for pressing the Enter Key
But did not get any success

Thanks
Aneel

aneel pal

unread,
Jan 14, 2014, 1:48:22 PM1/14/14
to mercu...@googlegroups.com
Hi Kishore,

Through you code i was able to select the item in WebList but selected option is not reflected in WebList

I think my problem is not clear to everyone, so i am explaining it more clearly.

Suppose we have WebList with all the Country name and if i selected "India" after expanding the WebList and then after collasping the Weblist "India" should display in Weblist as selected option.


Thanks
Aneel


On Tue, Jan 14, 2014 at 9:15 PM, Kishor Kumar <kisho...@gmail.com> wrote:

Kishor Kumar

unread,
Jan 14, 2014, 8:51:58 PM1/14/14
to mercuryqtp
@Aneel,
can you post the innerhtml and outerhtml code and why specifically your are =verifying "SELECTION" propertry, why cannot you verify value property of the list


QTP Tutorialnet

unread,
Jan 14, 2014, 10:22:55 PM1/14/14
to mercu...@googlegroups.com
Hello,

First, You do not need to use the Frame object in your code. It's just a hassle to identify. You will be fine doing this...
browser().page().webtable, save yourself the time. Second, I think I understand your problem.  So you are saying that you are able to select, but it is not displaying, right? But can I ask, why do you want it to display? What is your ultimate goal? I think this will help us to understand so we can come up with a solution.


You received this message because you are subscribed to a topic in the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mercuryqtp/fAfmbT2BwmY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mercuryqtp+...@googlegroups.com.

aneel pal

unread,
Jan 15, 2014, 11:29:00 AM1/15/14
to mercu...@googlegroups.com
Hi QTP Tutorialnet,

After Selecting the Color from the Web list I am entering the value in another Webedit box and then I am clicking on "Save" button so while saving my application throws an error i.e. Color is not selected.

I think you can understand my problem.

Thanks
Aneel


aneel pal

unread,
Jan 15, 2014, 12:01:50 PM1/15/14
to mercu...@googlegroups.com
Hi Kishore,

I am getting same result if am using property "Value".

innerhtml: <option title=""></option><option title="Blue" value="2">Blue</option><option title="Red" value="1">Red</option><option title="Green" value="3">Green</option><option title="Yellow" value="4">Yellow</option><option title="Amber" value="5">Amber</option><option title="White" value="6">White</option>

outerhtml : <select tabindex="-1" title="" class="ms-crm-SelectBox ms-crm-Inline-OptionSet-AutoOpen" id="hppscm_colorcode_i" aria-labelledby="hppscm_colorcode_c hppscm_colorcode_w" style="height: 74px;" size="7" attrName="hppscm_colorcode" defaultSelected="3" attrPriv="7" controlmode="normal" defaultvalue="3"><option title=""></option><option title="Blue" value="2">Blue</option><option title="Red" value="1">Red</option><option title="Green" value="3">Green</option><option title="Yellow" value="4">Yellow</option><option title="Amber" value="5">Amber</option><option title="White" value="6">White</option></select>

Thanks,

Aneel

Kishor Kumar

unread,
Jan 15, 2014, 12:57:13 PM1/15/14
to mercuryqtp
@Aneel,

If i understand correctly, once you select any item from dropdown, selected value should be displayed in selection  area of the listbox, 

use below code.


assume weblist exist in Row2 , column 3. then
''=============================================================
Set RefList=Br().p().Webtable().childItem(row,col,"WebList",0)

RefList.Select "#1"
RefList.FireEvent "Onclick"
''============================================================
if above one not working try below one.

''============================================================
Setting.WebPackage("ReplayType") = 2 'Mouse

Set RefList=Br().p().Webtable().childItem(row,col,"WebList",0)

RefList.Select "#1"

Setting.WebPackage("ReplayType") = 1 'Events

''=================================================
Regards,
Kishor

Bhuvan Sundar

unread,
Jan 15, 2014, 9:23:05 PM1/15/14
to mercu...@googlegroups.com

Try with below code
Browser ().page ().frame ().weblist ().select "Blue"

Tnx,
Bhuvan

aneel pal

unread,
Jan 16, 2014, 10:39:11 PM1/16/14
to mercu...@googlegroups.com
Hi Kishore,

If I am using Replay Type Code then QTP is not identifying the Weblist ill the session exist, I write the code in the same way as you mentioned in your e-mail.

I checked without the Replay type(after ending the session) then QTP is able to identify the weblist.

Below is the detail of Env.

QTP Version : 9.5 (Trial)
OS : Windows 7
Application: MS CRM 2013

Your Help is appreciable,
Aneel

Kishor Kumar

unread,
Jan 17, 2014, 8:53:39 AM1/17/14
to mercuryqtp
Hi Aneel,
I am running out of thoughts,
take the line Setting.WebPackage("ReplayType") = 2 'Mouse
and observe close the DOM of control using FireBug in Firefox, if application is accessibile in Firefox,

look , you have any specific event is triggered when you the selection of Item from dropdown.
you can see some thing like onchange()=... or onMousemove()=....

if u have any such events , then use qtp to perform event using Fireevent like

b.p.weblist().object.firevent "onClick"...

and suggest you to verity the same code with QTP11  or 11.5 and verify required patches , installed


Prasad.L.V

unread,
Jan 20, 2014, 10:19:38 AM1/20/14
to mercu...@googlegroups.com
facing similar issue with IE

in my case:
I have a WebList with default value as "Last week".

when ever i set this list to "All"(which is one of the value in list), its defaulting to default value only at the time of execution when i try with new script (not in a business/execution flow) its works fine.

1st Attempt

Browser(browserName).Page(pageName).WebList("MyList").Set "All"

2nd attempt (with index value)
      Setting.WebPackage("ReplayType") = 2
Browser(browserName).Page(pageName).WebList("MyList").Set (0)
       Setting.WebPackage("ReplayType") = 1

Browser(browserName).Page(pageName).WebList("MyList").WaitProperty "selection", "All", 5000

not luck with any way, its always defaulting to default value at the time of execution, Could any please suggest is there a way to get my desired value to set.

Thank you,
L V Prasad. K

Prasad.L.V

unread,
Jan 21, 2014, 1:37:12 AM1/21/14
to mercu...@googlegroups.com
it worked in below way:

strCount=Browser("Browser Name").Page("Page Name").WebList("MyList").GetRoProperty("items count")

for i = 0 to strCount

strValue=Browser("Browser Name").Page("Page Name").WebList("MyList").GetItem(i)
AppID="All"
If Trim(strValue)=trim(AppID) Then
Browser("Browser Name").Page("Page Name").WebList("MyList").Select strValue
Exit for
End if

Next
End if

aneel pal

unread,
Jan 21, 2014, 1:40:22 PM1/21/14
to mercu...@googlegroups.com
Hi Prasad,

I tried your code also but did not get any success.

In place of "All" I used the value "Red" in code as it is one of the option in my web list
AppID="All"

Thanks,
Aneel

Reply all
Reply to author
Forward
0 new messages