Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading values form data table
#1
Not Solved
Hi,

When I am trying to read a value from data table, the value is shown in double quotes.
eg: value in datatable is - Image
When I used this value in my script it is used as "Image",here it is represented as string.
I want to use the value same,I mean I would like to use this as - Image

How to get the value without quotes.
Any help on this..

Thanks,
venkat
Reply
#2
Not Solved
Can you put colon (') in the starting of the cell of your datatable and check whether the same is coming?
Reply
#3
Not Solved
I have tried by putting the colon in the starting of the cell even though getting the same problem.
The retrived value from data table is always treated as string and shown in double quotes.
Reply
#4
Not Solved
Can you put your code here?
Reply
#5
Not Solved
My data table is like following,


Browser Page type value
Login Login Link Help_link

Browser,Page,type,value names are column names and the values for those are Login,Login,Link,Help_link

I am storing the values in variables,

Code:
strBrowser = DataTable("Browser","Action1")
strPage = DataTable("Page","Action1")
strType = DataTable("Link","Action1")
strValue = DataTable("value","Action1")

here i am writing a command using the above values

Code:
Browser(strBrowser).Page(strPage).strType(strValue).Click

When I run the code it fails, because it replace the above line as

Code:
Browser("Login").Page("Login")."Link"("Help_link").Click

Here I need to remove the quotes for Link.

Thanks!
Reply
#6
Not Solved
You can not pass the object value like this. I think you are trying to prepare one function for click event for all the objects. You need to pass the entire hierarchy of that object.
In your example you are trying to click on the Link object. Link is the name of the class and you have to explicitly define it into your script.
Reply
#7
Not Solved
Hi new4qtp,

Anirban is right. Link is the name of the class and you have to write it in your script.

And the way you are passing values to Browser, Page or Link doesn't work. You have to specify the properties for which you are storing the values in the data table.

Try to analyze the following,

Lets take the Google page as our example.
Suppose you want to click through the "Gmail" link in the Google page. The hierarchy to which we need to follow is like:
Browser().Page().Link().Click

Here for "Browser" and "Page" object, we have several properties like "name","title" etc. and for Link object we have "name" as a property along with many more.

Suppose you have stored the "name" of the Browser,Page, and Link object in your DataTable under "Browser","Page" and "Link" columns respectively.

Then retrieve the values like:
Code:
BrowserName = DataTable("Browser",dtLocalSheet)
PageName = DataTable("Page",dtLocalSheet)
LinkName = DataTable("Link",dtLocalSheet)

Now you can write like:

Code:
Browser("name:="&BrowserName).Page("name:="&PageName).Link("name:="&LinkName).Click

Note that here you are explicitly providing the object class and property and providing only values from the DataTable.

For this example, Browser and Page name is "Google" and Link name is "Gmail"

Hope you can understand now.
Reply
#8
Not Solved
Hi Prabhath,

Thanks for the detailed info.

Now I am writing the code like follows and achieve the things,

Case "Link"
Code:
Browser("name:="&BrowserName).Page("name:="&PageName).Link("name:="&LinkName).Exist

Case "WebElement"
Code:
Browser("name:="&BrowserName).Page("name:="&PageName).WebElement("name:="&LinkName).Exist
Adding the cases here for all the types of classes, so my script is running and returning the results for all the rows by matching the corresponding case.

Using the above code checking the UI elements on the page not performing any actions.
Is this right approach?

Thanks,
Venkat
Reply
#9
Not Solved
Hi Venkat,

I did not get what exactelly you want to do. Can you please elaborate what do you mean by "checking UI elements on the page not performing any actions".

But according to my personal view, this is not the way things are/should be done, because you cann't retrieve all the values from DataTable and use it when your test is considerably larger. This is why we have something called "Automation Frameworks" where things are done in a nice approach.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading Global Sheet's DataTable Value Bhuvana 0 1,475 01-05-2020, 10:03 PM
Last Post: Bhuvana
  Can we test Salesforce Standard form using QTP? yona34 0 943 05-22-2018, 10:57 AM
Last Post: yona34
  Reading Value from Java Table arjun.singh 8 23,851 10-11-2017, 02:51 PM
Last Post: sivaji
  Reading data from excel sheet serenediva 1 8,893 03-03-2017, 10:07 AM
Last Post: vinod123
  data table use uft_usr 1 2,112 06-29-2016, 05:23 PM
Last Post: Ankesh

Forum Jump:


Users browsing this thread: 1 Guest(s)