1

I am very new to selenium ide,How can we read excelsheet data in selenium IDE. I have searched in google but not found particular links which I wanted .I got one link where they are reading excelsheet using eclipse, junit,testNG etc. Is it possible to read data of excelsheet in selenium ide and use that data in selenium ide test cases and also i want to export my test suit result in excelsheet.

Please reply

Thank you

vnnogile
  • 33
  • 1
  • 1
  • 9
  • Unfortunately, there is no option to access Excel files via Selenium IDE. – Fenio Mar 16 '15 at 14:51
  • Thanks Rafal ,I got one link where it shows how to read excelsheet and data used in selenium RC using TestNG framework, I want to share that link with all http://functionaltestautomation.blogspot.in/2009/10/dataprovider-data-driven-testing-with.html – vnnogile Mar 18 '15 at 07:18

2 Answers2

2

Though I'm late to the show, I hope the following instructions will at least be of some use to anyone looking to automate part of their workflow. The method detailed below will allow automated web form entry from data in a CSV file using only Selenium IDE.

What you'll need: 1.) Selenium IDE 2.) CSV File Reader plugin // This can be acquired at seleniumhq.org/download then proceed to download at Github 3.) Selblocks // a language extension which permits use of conditonals & looping

Now that you have the necessary tools, fire up Firefox and navigate to your Selenium IDE options. You'll want to copy the path of the File Reader (.js) to Selenium Core Extensions to enable use. With that out of the way, verify that Selblocks installed without issue by typing in "while"; if this command is recognized (i.e. auto-completes/has a reference description) then all went well. Now verify that the File reader plugin commands are accessible by typing in "readCSV"; again if it auto-completes the command that means you're good to go.

Your target for the readCSV command is the path to your file (ex: file:\C:/Test.csv). To read the entire contents of the csv file, you'll need a simple while loop. Here's a sample framework:

...
<tr>
    <td>store</td>
    <td>4</td>
    <td>loop</td>
</tr>
<tr>
    <td>store</td>
    <td>1</td>
    <td>p</td>
</tr>
<tr>
    <td>while</td>
    <td>${p}&lt;${loop}</td>
    <td></td>
</tr>
<tr>
    <td>open</td>
    <td>https://automatestuff.com/go </td>
    <td></td>
</tr>
<tr>
    <td>readCSV</td>
    <td>file:\C:/Test.csv</td>
    <td></td>
</tr>
<tr>
    <td>storeCellValue</td>
    <td>SomeData</td>
    <td>${p},1</td>
</tr>
<tr>
    <td>storeCellValue</td>
    <td>MoreData</td>
    <td>${p},2</td>
</tr>
<tr>
    <td>echo</td>
    <td>${SomeData}</td>
    <td></td>
</tr>
<tr>
    <td>echo</td>
    <td>${MoreData}</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>${p}+1</td>
    <td>p</td>
</tr>
....
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>

...

Your target value (in this example, 4) for the first store command will vary given the size of your dataset. The while expression will run through your data until it evaluates to false. In this example, I have data being read from column 1, row 1 (and so on) and column 2, but it's possible to configure more or less.

Anyway, I hope that's clear and gets you on your way to automating the mundane bits of your workflow.

0

You can probably hack together something for this that uses javascript to read in files, but I think you should question WHY you want to do it this way instead. Why do you need excel files or why are you limited to IDE testing?

But maybe some help on excel files & javascript: How to read an excel file contents on client side?

Community
  • 1
  • 1
DMart
  • 2,401
  • 1
  • 14
  • 19
  • Hi Dmart, actually i am very new to selenium so i thought may be it is possible to read excelsheet in selenium ide easily – vnnogile Mar 18 '15 at 07:26
  • I runned test case in eclipse luna successfully but now i wanted to export my test case result in excelsheet.How can i do this – vnnogile Mar 18 '15 at 07:37
  • What language do you use? If Java, then I suggest using Java Excel API. It's very powerful library to manipulate excel files. Both - writing and reading. – Fenio Mar 18 '15 at 08:54
  • @Rafal he mentions he wants to use selenium IDE which is in selenese with javascript hooks. If he wants to run selenium webdriver in java that's a different story – DMart Mar 18 '15 at 22:10
  • He asked how to export test case result in excelsheet using eclipse luna. – Fenio Mar 19 '15 at 08:56
  • So he did. His question is all over the place. Sorry. – DMart Mar 19 '15 at 22:05