0

I am able to capture Json data from a website using "selenium.captureNetworkTraffic("json")".

I want to filter the results for a particular grid in my website..(My website contains many grids). How to filter the data for a grid of the website ?

And also while using DefaultSelenium, I want to wait for 1 minute after opening the website.

my code :

SeleniumServer srvr = new SeleniumServer(); 
srvr.start(); 
String site="website_name"; 
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox",site ); 
selenium.wait(); 
selenium.start("captureNetworkTraffic=true"); 
selenium.open("/"); 
String trafficOutput = selenium.captureNetworkTraffic("json"); 
System.out.println(trafficOutput);

How to do that ?

user3145373 ツ
  • 7,858
  • 6
  • 43
  • 62
Annant
  • 3
  • 3
  • SeleniumServer srvr = new SeleniumServer(); srvr.start(); String site="website_name"; DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox",site ); selenium.wait(); selenium.start("captureNetworkTraffic=true"); selenium.open("/"); String trafficOutput = selenium.captureNetworkTraffic("json"); System.out.println(trafficOutput); – Annant Sep 04 '14 at 08:18
  • this is not like that I ll post in comment so you also have to answer in comment, you can post code by editing your code.. – user3145373 ツ Sep 04 '14 at 08:20

1 Answers1

0

First time seeing Selenium; and it's yucky. Only 3 valid options for "captureNetworkTraffic" in which an Enum would properly restrict the API yet an unrestricted string is all that is accepted.

Still, selenium doesn't do any filtering of the data (besides topically retrieving content) and simply passes it to you for your own (mis)handling.

So, what you're wanting is essentially answered here: How to parse JSON in Java

Community
  • 1
  • 1
Alex
  • 24
  • 3