HOW TO PERFORM DATA DRIVEN USING JSON IN SELENIUM IDE ?

We can do JSON data driven in Selenium IDE using SelBlocks.
Here is the very basic example to perform JSON data driven in Selenium IDE using SelBlocks.




Create a testdata.json file in the C drive with following details:

[
  { keyword: "hello selenium" }
 ,{ keyword: "abhishek yadav qa" }
]




  • Write the below script in Selenium IDE.
Command
Target
Value
forJson
file://c:/testdata.json
open
/

waitForPageToLoad
5000

typeAndWait
name=q
${keyword}
endForJson


* Base URL:
http://www.google.co.in/




  • Save the recorded script.
  • Run the recorded script.






Post a Comment

3 Comments

  1. Thank you for your good site. Can I use forJson with URL , for example a url for a servlet that returns .json file?

    ReplyDelete
    Replies
    1. @Mehdi, yes you can. Basically forJson looks for JSON data.

      Delete
  2. Thanks!

    Can you please help me? I need to handle Json files (Request/Response) using Selenium WebDriver + TestNG in Eclipse. I am looking for framework which will be good. I mean..I am thinking of Keyword driven framewwork which will be excel driven, we will write test cases in excel using the keywords (opening json file, reading it, extracting the value from json, doing required operations etc).

    Please provide your inputs and how can I achieve this?

    ReplyDelete


What would you like to add in my list? I look forward to reading your comments below.