Can we get Cell values in excel using column names as reference. TestWise/ Selenium-Webdriver - RSpe

3,372 views
Skip to first unread message

Mohan MK

unread,
Feb 2, 2015, 7:22:15 AM2/2/15
to seleniu...@googlegroups.com

Hi All,

I am trying to make my script datadriven, but would like to reference the data from data sheet through column names.
This is what i had used in QTP

DataElementValue = DataTable.GetSheet(DataSheetName).GetParameter(DataFileColumnName).ValueByRow(LoopDataFileRow(i))
Is it possible ? i am using win32ole / selenium-webdriver (RSpec) / TestWise
 
Test_Case = @wrksheet.cells(@rows,"A") ['text']  works fine but
i want to reference it with column header (@rows,'TestCase') ['tect']. below is the data in Data sheet

     A                B                 C
TestCase     UserId        Password
valid            bob             test
invalid          bob            badpass
 

Thanks in Advance
M.K.Mohan

Oscar Rieken

unread,
Feb 2, 2015, 7:47:18 AM2/2/15
to seleniu...@googlegroups.com
This really has nothing to do with Selenium/WebDriver. I think it has to deal more with the library you are using to access your data sheet, testing framework and general coding. you might get a faster response asking the community for that library 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/12f715e2-6ab9-48f3-b4ea-a10a5d984758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohan MK

unread,
Feb 2, 2015, 11:07:13 AM2/2/15
to seleniu...@googlegroups.com
Hi Oscar,
 
what i ment is is there any library that supports fetching cell data using column header name insted of number. What i am gtrying to do is pass the column name then iterate though data file and get the cel data in ruturn for given row.
 
Regards,
M.K.Mohan

Oscar Rieken

unread,
Feb 2, 2015, 11:55:37 AM2/2/15
to seleniu...@googlegroups.com
I don't know i tend to not use data sheets. for my test data. 

Selenium Framework

unread,
Feb 2, 2015, 2:02:40 PM2/2/15
to seleniu...@googlegroups.com
Mohan, you posted the same question in Ruby watir webdriver groups too - This question is related to data parsing and not necessarily Selenium. 

If you are using Java, you can use Apache POI and build a custom block of code that does what you look for. Below is JAva code, however in the future please refrain posting non-Selenium questions here.


Cheers,

Mohan MK

unread,
Feb 3, 2015, 1:25:20 AM2/3/15
to seleniu...@googlegroups.com
Sorry for the duplication
 
Regards,
M.K.Mohan

Abhi ram

unread,
Feb 3, 2015, 3:03:40 AM2/3/15
to seleniu...@googlegroups.com
Hi Mohan MK

for your question to get the data from the excel with the help of column
Name. So for all this Excel operation i was created on new library in java
called POIRE. in this i included all the static methods which is related to
test data for the framework. This i completely developed on the top of the
POI so just add those jar in your build path including this POIRE jar.

https://github.com/ssirekumar/POIRE
https://github.com/ssirekumar/POIRE/releases

Solution for your issuse With POIRE:

ArrayList<String> _colNames =
ExcelDataEngine.getExcelColumnWithHeaderName("WorkBook_2010_1.xlsx", "A",
"SheetName", true);
for(ArrayList<String> listValue : _colNames){
System.out.println(listValue);
}

with this you can get all the column values. For more information just
download the Doc of this library.

Thanks
~Ssire






--
View this message in context: http://selenium.10932.n7.nabble.com/Can-we-get-Cell-values-in-excel-using-column-names-as-reference-TestWise-Selenium-Webdriver-RSpe-tp42427p42446.html
Sent from the Selenium - Users mailing list archive at Nabble.com.
Reply all
Reply to author
Forward
0 new messages