Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use Datatable values for automating Weblist in a web page
#1
Solved: 11 Years, 4 Months ago
Hi team,

Can anyone provide solution on the below mentioned scenario?

In one URL, the pages are like as I mentioned below:
1.First page, click on Create New account
2.second page, click on continue in the Registration process page
3.third page, select Country, Language, Date of birth and continue
4.fourth page, click "Master account"
5.fifth page, "terms and service" will be displayed.

My task is to automate the entire process. In the 3rd step, there is dropdown for countries(several countries are present) for some countries, there is more than 1 language.For example Belgium has English and Deutsch;

I have hardcoded for one country and one language, it is working fine now. But I want to use DataTable which has all the countries,languages and IELangPref as columns, Test script should take values from DataTable.

For example, Australia(Country) is chosen, then English (Language) is chosen and Date of birth should be taken.
I have used Object Spy to find out the property of dropdown, and found to be "Web List"

Please provide your suggestions on how to solve my problem.
Thanks,
Kishore
Reply
#2
Solved: 11 Years, 4 Months ago
Hi,

This can be handled in many ways, but i will explain what i did in this kind of scenario.
First in a datatable, gather all the available countries and their respective languages and then do a loop

Sno Country Language
1 US English
2 India Hindhi
3 India Tamil

etc..

else, dynamically write in to the datatable from the weblist of all country and langauge and then do loop.
Hope, you got my point.
Reply
#3
Solved: 11 Years, 4 Months ago
Hi kkishore12345,

Try with the following procedure:

First of All, Store all required test data in Datatable(Global or Local Sheet) & then In File Menu --> Settings --> Run Tab --> Choose "Run On only One Iteration" Option) :

Code:
rc=Datatable.GetSheet("Global").GetRowCount
For i=1 to rc  ' Start of Main Loop
Datatable.GetSheet("Global").SetCurrentRow(i)
Browser("browser").Page("Page1").link("Create New Account").Click
Browser("browser").Page("Page2").link("Continue").click

Expected_DOB=trim(Datatable("DateOfBirth",dtglobalSheet))
Browser("browser").Page("Page3").Weblist("Date Of Birth").Select Expected_DOB


Expected_country=trim(Datatable("countries",dtglobalSheet))
country_Count=Browser("browser").Page("Page3").Weblist("Country").GetROProperty("Items Count")
For j=1 to country_Count
    Actual_country=trim(Browser("browser").Page("Page3").Weblist("Country").GetItem(j))
             if (Expected_country=Actual_country) then
                 Browser("browser").Page("Page3").Weblist("Country").Select j
                 Exit for
             end if
Next

Expected_Language=trim(Datatable("IELangPref",dtglobalSheet))
Languages_Count=Browser("browser").Page("Page3").Weblist("Languages").GetROProperty("Items Count")
For k=1 to Languages_Count
    Actual_Language=trim(Browser("browser").Page("Page3").Weblist("Languages").GetItem(k))
             if (Expected_Language=Actual_Language) then
                 Browser("browser").Page("Page3").Weblist("Languages").Select k
                 Exit for
             end if
Next
Browser("browser").Page("Page3").link("Continue").click
Browser("browser").Page("Page4").link("Master Account").click

' Navigate Back to Page1

Next    ' End of Main Loop
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  WEBLIST shayk1985 3 5,601 05-17-2018, 11:49 AM
Last Post: Ankur
  click each web link in a page using Index or other method in QTP smeijer 13 24,682 04-29-2017, 04:53 PM
Last Post: kowshik
  Automating SAP Sales Order Dwarak Calayampundi 0 1,715 06-09-2016, 09:28 AM
Last Post: Dwarak Calayampundi
  VB Script to count number of links in a web page. Suma Parimal 4 25,258 07-01-2015, 12:59 PM
Last Post: govind
  Weblist selection diya 11 21,353 06-16-2015, 08:27 PM
Last Post: rajpradeep32

Forum Jump:


Users browsing this thread: 1 Guest(s)