QTP WebRadioGroup means
a radio button on the web page. Identifying and working with them can be easy
or difficult. Sometimes they works out fine and at times executing the same
code gives you error.
If you have two radio buttons on the screen for example Gender selection options the code below might give problem.
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender").Select "Male"
Where "Male" can be the id or the value of the radio button (Spy the object). So what is the problem in the code above? As there are two radio buttons QTP identifies them as same, so we need to differentiate between them. Index is a property by which you can differentiate, it tells the position of the object. So if we write the same code below with an additional index property it will work fine.
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender", "index:= 1").Select "Female"
This code is intended to select a radio button among two, what if you have a list of radio buttons let’s say 5-6 or more, than the above code won’t help. For that you need to create description of a radiogroup i.e. we will instruct everything to QTP.
''''''=====Initialize variables
Dim oWebRadio
Dim oWebRadioCount
Dim RadioToSelect_Val
''''''Create description using Description.Create build-in method
Set oWebRadio = Description.Create
oWebRadio ("micclass").value = "WebRadioGroup"
oWebRadio ("type").value = "radio"
oWebRadio ("name").value="Gender"
''''''Pass the description in another variable using ChildObjects method
Set oWebRadioCount = Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").ChildObjects(oWebRadio)
''''''Loop to select desired value
For i = 0 to oWebRadioCount
RadioToSelect = oWebRadioCount (i).GetROProperty("value")
oWebRadioCount (i).Select RadioToSelect
Next
''''''Pass Child count in a variable
allItems = oChild.Count
''''''Loop & Use items count property to get Total items
For j = 0 to allItems-1
itemsCount =oChild.Item(j).GetRoProperty("items count")
If (itemsCount = 5) Then
Print "Found 5 radio "
else
Print "More than 5 radio listed"
End If
Next
So there are two ways to deal with descriptive programming, either pass the properties directly or create your descriptions and pass or select your values.
'============= Ways to select value from WebList =======================
Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr").Select "#3"
Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr").Select "2218866589&15-5-2013"
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender").Select "#0"
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender").Select "Female"
'========== To Count Number and Name of WebRadioGrouppresent on a Page Using MicClass ======
'Example: 1 This page has One Radio Group
SystemUtil.Run "iexplore", "http://youngistaancafe.blogspot.com/2013/07/qtp-web-table_5925.html"
Set oWebRadio = Description.Create
oWebRadio("micclass").value="WebRadioGroup"
Set oWebRadioCount = Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").ChildObjects(oWebRadio)
vrCount = oWebRadioCount.Count
msgbox vrCount
For i=0 to vrCount-1
msgbox oWebRadioCount(i).GetROProperty("name")
Next
'Example: 2 This page has Two Radio Groups
SystemUtil.Run "iexplore", "http://youngistaancafe.blogspot.com/2013/07/student-registration-formhtml.html"
Set oWebRadio = Description.Create
oWebRadio("micclass").value="WebRadioGroup"
Set oWebRadioCount = Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").ChildObjects(oWebRadio)
vrCount = oWebRadioCount.Count
msgbox vrCount
For i=0 to vrCount-1
msgbox oWebRadioCount(i).GetROProperty("name")
Next
'To find Number of Radio Buttons present in particular Group along with its value
With Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr")
vrAllItem = .GetROProperty("all items")
msgbox vrAllItem
vrArr = Split(vrAllItem, ";", -1, 1)
For i=0 to UBound(vrArr)
msgbox vrArr(i)
vrLeftPNR = Left(vrArr(i),10)
msgbox vrLeftPNR
If vrPNR = vrLeftPNR Then
vrIndex = i
.Select "#"&vrIndex
Exit For
End If
Next
End With
'=========Select WebRadio button where PNR# is 5018866589================
vrPNR = "5018866589"
With Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr")
vrAllItem = .GetROProperty("all items")
msgbox vrAllItem
vrArr = Split(vrAllItem, ";", -1, 1)
For i=0 to UBound(vrArr)
msgbox vrArr(i)
vrLeftPNR = Left(vrArr(i),10)
msgbox vrLeftPNR
If vrPNR = vrLeftPNR Then
vrIndex = i
.Select "#"&vrIndex
Exit For
End If
Next
If you have two radio buttons on the screen for example Gender selection options the code below might give problem.
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender").Select "Male"
Where "Male" can be the id or the value of the radio button (Spy the object). So what is the problem in the code above? As there are two radio buttons QTP identifies them as same, so we need to differentiate between them. Index is a property by which you can differentiate, it tells the position of the object. So if we write the same code below with an additional index property it will work fine.
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender", "index:= 1").Select "Female"
This code is intended to select a radio button among two, what if you have a list of radio buttons let’s say 5-6 or more, than the above code won’t help. For that you need to create description of a radiogroup i.e. we will instruct everything to QTP.
''''''=====Initialize variables
Dim oWebRadio
Dim oWebRadioCount
Dim RadioToSelect_Val
''''''Create description using Description.Create build-in method
Set oWebRadio = Description.Create
oWebRadio ("micclass").value = "WebRadioGroup"
oWebRadio ("type").value = "radio"
oWebRadio ("name").value="Gender"
''''''Pass the description in another variable using ChildObjects method
Set oWebRadioCount = Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").ChildObjects(oWebRadio)
''''''Loop to select desired value
For i = 0 to oWebRadioCount
RadioToSelect = oWebRadioCount (i).GetROProperty("value")
oWebRadioCount (i).Select RadioToSelect
Next
''''''Pass Child count in a variable
allItems = oChild.Count
''''''Loop & Use items count property to get Total items
For j = 0 to allItems-1
itemsCount =oChild.Item(j).GetRoProperty("items count")
If (itemsCount = 5) Then
Print "Found 5 radio "
else
Print "More than 5 radio listed"
End If
Next
So there are two ways to deal with descriptive programming, either pass the properties directly or create your descriptions and pass or select your values.
'============= Ways to select value from WebList =======================
Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr").Select "#3"
Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr").Select "2218866589&15-5-2013"
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender").Select "#0"
Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").WebRadioGroup("name:=Gender").Select "Female"
'========== To Count Number and Name of WebRadioGrouppresent on a Page Using MicClass ======
'Example: 1 This page has One Radio Group
SystemUtil.Run "iexplore", "http://youngistaancafe.blogspot.com/2013/07/qtp-web-table_5925.html"
Set oWebRadio = Description.Create
oWebRadio("micclass").value="WebRadioGroup"
Set oWebRadioCount = Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").ChildObjects(oWebRadio)
vrCount = oWebRadioCount.Count
msgbox vrCount
For i=0 to vrCount-1
msgbox oWebRadioCount(i).GetROProperty("name")
Next
'Example: 2 This page has Two Radio Groups
SystemUtil.Run "iexplore", "http://youngistaancafe.blogspot.com/2013/07/student-registration-formhtml.html"
Set oWebRadio = Description.Create
oWebRadio("micclass").value="WebRadioGroup"
Set oWebRadioCount = Browser("name:=Youngistaan Cafe: Student Registration Form.html").Page("title:=Youngistaan Cafe: Student Registration Form.html").ChildObjects(oWebRadio)
vrCount = oWebRadioCount.Count
msgbox vrCount
For i=0 to vrCount-1
msgbox oWebRadioCount(i).GetROProperty("name")
Next
'To find Number of Radio Buttons present in particular Group along with its value
With Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr")
vrAllItem = .GetROProperty("all items")
msgbox vrAllItem
vrArr = Split(vrAllItem, ";", -1, 1)
For i=0 to UBound(vrArr)
msgbox vrArr(i)
vrLeftPNR = Left(vrArr(i),10)
msgbox vrLeftPNR
If vrPNR = vrLeftPNR Then
vrIndex = i
.Select "#"&vrIndex
Exit For
End If
Next
End With
'=========Select WebRadio button where PNR# is 5018866589================
vrPNR = "5018866589"
With Browser("name:=Youngistaan Cafe: QTP Web Table").Page("title:=Youngistaan Cafe: QTP Web Table").WebTable("name:=Passenger 1").WebRadioGroup("name:=rnd_pnr")
vrAllItem = .GetROProperty("all items")
msgbox vrAllItem
vrArr = Split(vrAllItem, ";", -1, 1)
For i=0 to UBound(vrArr)
msgbox vrArr(i)
vrLeftPNR = Left(vrArr(i),10)
msgbox vrLeftPNR
If vrPNR = vrLeftPNR Then
vrIndex = i
.Select "#"&vrIndex
Exit For
End If
Next
End With
hi how to select radio buttons alternatively .......Tech mahendra question
ReplyDeleteU can use Index value ... and wid the help of loop... counter+2... u can select alternate radio buttons...
ReplyDeleteHi Hardeep,
ReplyDeleteThis one is using descriptive programming,i need some hints how to work with datatable. Here i am having flightbooking as reusable action with 2 rows of testdata in datatable.
now i have 2 Testcases like TC1 will apply call to existing and fetches 1st row data from datatable, but in TC5 i use copy to action and set to nextrow and works fine it till reaches the radio button option where i need to select different service class , it says object cannot be identified so how to work with radio buttons using datatable.
Ciitnoida provides Core and java training institute in noida. We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-oriented, java training in noida , class-based build of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an all-time high not just in India but foreign countries too.
ReplyDeleteBy helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13 years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best Java training in Noida.
java training institute in noida
java training in noida
best java training institute in noida
java coaching in noida
java institute in noida
Sap Training Institute in Noida
ReplyDeleteCIIT Noida provides Best SAP Training in Noida based on current industry standards that helps attendees to secure placements in their dream jobs at MNCs. CIIT Provides Best ERP SAP Training in Noida. CIIT is one of the most credible ERP SAP training institutes in Noida offering hands on practical knowledge and full job assistance with basic as well as advanced level ERP SAP training courses. At CIIT ERP SAP training in noida is conducted by subject specialist corporate professionals with 7+ years of experience in managing real-time ERP SAP projects. CIIT implements a blend of aERPemic learning and practical sessions to give the student optimum exposure that aids in the transformation of naïve students into thorough professionals that are easily recruited within the industry.
At CIIT’s well-equipped ERP SAP training center in Noida aspirants learn the skills for ERP SAP Basis, ERP SAP ABAP, ERP SAP APO, ERP SAP Business Intelligence (BI), ERP SAP FICO, ERP SAP HANA, ERP SAP Production Planning, ERP SAP Supply Chain Management, ERP SAP Supplier Relationship Management, ERP SAP Training on real time projects along with ERP SAP placement training. ERP SAP Training in Noida has been designed as per latest industry trends and keeping in mind the advanced ERP SAP course content and syllabus based on the professional requirement of the student; helping them to get placement in Multinational companies and achieve their career goals.
ERP SAP training course involves "Learning by Doing" using state-of-the-art infrastructure for performing hands-on exercises and real-world simulations. This extensive hands-on experience in ERP SAP training ensures that you absorb the knowledge and skills that you will need to apply at work after your placement in an MNC.
You truly did more than visitors’ expectations. Thank you for rendering these helpful, trusted, edifying and also cool thoughts on the topic to Kate.
ReplyDeleteHadoop Training in Chennai
From your discussion I have understood that which will be better for me and which is easy to use. Really, I have liked your brilliant discussion. I will comThis is great helping material for every one visitor. You have done a great responsible person. i want to say thanks owner of this blog.
ReplyDeletepython training in chennai | python training in bangalore
python online training | python training in pune
python training in chennai
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
ReplyDeleteData Science training in marathahalli
Data Science training in btm
Data Science training in rajaji nagar
Data Science training in chennai
Data Science training in kalyan nagar
Data Science training in electronic city
Data Science training in USA
Thank you so much for a well written, easy to understand article on this. It can get really confusing when trying to explain it – but you did a great job. Thank you!
ReplyDeletepython training in tambaram
python training in annanagar
python training in Bangalore
First of all Big thanks for sharing this with us. Excellent content with a cool idea, the great content of various kinds of the valuable information.
ReplyDeleteSelenium Training in Chennai
Loadrunner Training in Chennai
PHP Training in Chennai
cloud computing training in chennai
Salesforce Training in Chennai
DOT NET Training in Chennai
Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much.
ReplyDeleteWeb Designing Course in chennai
web design training chennai
web design training in chennai
website designing training
web designing training
web designing in chennai
This information is impressive. I am inspired with your post writing style & how continuously you describe this topic. Eagerly waiting for your new blog keep doing more.
ReplyDeleteSpanish Classes in Chennai
Spanish Language Course in Chennai
Japanese Classes in Chennai
Spanish Courses in Chennai
German Language Classes in Chennai
Spanish Institute in Chennai
French Institute in Chennai
German Classes in Chennai
Nice blog. Can't be written much better. You’re doing a great job. Keep continuing.
ReplyDeleteTOEFL Coaching Centres in Ambattur Chennai
TOEFL Classes in Ambattur OT
TOEFL Course in Redhills
Best TOEFL Institute in Chennai
IELTS Training Centre in Chennai
Best Spoken English Class in Chennai
I am feeling greatful to read this.you gave a nice info for us.
ReplyDeleteplease update more.
Salesforce Training in Guindy
Salesforce Training in Saidapet
Salesforce Training in Ashok Nagar
Very informative article post. Really looking forward to read more. Will read on…
ReplyDeleteWeb Designing Training in Velachery
Web DesigningTraining in Chennai Velachery
Web Designing Training in Tnagar
Web Designing Training in Tambaram
Web Designing Training in Kandanchavadi
Web Designing Training in Sholinganallur
Thanks for sharing this pretty post, it was good and helpful. Share more like this.
ReplyDeleteAWS Training in Chennai
AWS Training institute in Chennai
AWS Training in Tambaram
DevOps Training in Chennai
RPA Training in Chennai
Blue Prism Training in Chennai
UiPath Training in Chennai
Really great post, I simply unearthed your site and needed to say that I have truly appreciated perusing your blog entries.
ReplyDeleteData Science Training in Chennai | Best Data science Training in Chennai | Data Science training in anna nagar | Data science training in Chennai
Data Science training in chennai | Best Data Science training in chennai | Data science training in Bangalore | Data Science training institute in Bangalore
Data Science training in marathahalli | Data Science training in Bangalore | Data Science training in btm layout | Data Science Training in Bangalore
Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
ReplyDeleteData Science Training in Chennai | Best Data science Training in Chennai | Data Science training in anna nagar | Data science training in Chennai
Data Science training in chennai | Best Data Science training in chennai | Data science training in Bangalore | Data Science training institute in Bangalore
Data Science training in marathahalli | Data Science training in Bangalore | Data Science training in btm layout | Data Science Training in Bangalore
I think you have a long story to share and i am glad after long time finally you cam and shared your experience.
ReplyDeleteonline Python training | python training in chennai
you have brainstormed my mind with your excellent blog. Thanks for that !
ReplyDeleteSelenium training in Chennai
Selenium Courses in Chennai
best ios training in chennai
Digital Marketing Training in Chennai
JAVA J2EE Training Institutes in Chennai
Selenium Interview Questions and Answers
cloud training in chennai
cloud computing training chennai
I am really very happy to find this particular site. I just wanted to say thank you for this huge read!! I absolutely enjoying every petite bit of it and I have you bookmarked to test out new substance you post.
ReplyDeleteMicrosoft Azure online training
Selenium online training
Java online training
uipath online training
Python online training
"After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.
ReplyDeleteDigital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery
"
this blog is very useful for who wants to learn DevOps course if you want to take DevOps training once go through thid blog.
ReplyDeletevery nice blog!!!
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training
Learn Amazon Web Services for excellent job opportunities from Infycle Technologies, the best AWS training institute in Chennai. Infycle Technologies gives the most trustworthy AWS course in Chennai, with full hands-on practical training from professional trainers in the field. Along with that, the placement interviews will be arranged for the candidates, so that, they can meet the job interviews without missing them. To transform your career to the next level, call 7502633633 to Infycle Technologies and grab a free demo to know more.Big Data Training in Chennai
ReplyDeleteInfycle Technologies, the No.1 software training institute in Chennai offers the No.1 Data Science course in Chennai for tech professionals and students at the best offers. In addition to the Data Science course, other in-demand courses such as Python, Selenium, Oracle, Java, Python, Power BI, Digital Marketing also will be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.
ReplyDeleteInfycle Technologies, the top software training institute and placement center in Chennai offers the Digital Marketing course in Chennai for freshers, students, and tech professionals at the best offers. In addition to the Oracle training, other in-demand courses such as DevOps, Data Science, Python, Selenium, Big Data, Java, Power BI, Oracle will also be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.
ReplyDeleteGreat post. Thanks for sharing such a worthy information.....
ReplyDeleteEthical Hacking course in Bangalore
Ethical Hacking Course in Pune
This post is so interactive and informative.keep update more information...
ReplyDeleteJava Training in Tambaram
java course in tambaram
Option catch tough begin perform. Effect military serious but management development.top 10 news today
ReplyDelete