Created
October 6, 2014 15:22
-
-
Save arlando/9ec1d684fcaed117c28a to your computer and use it in GitHub Desktop.
attachData.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Given("^I perform a query$") | |
| public static void I_perform_query() { | |
| driver.navigate().to("https://qa.1stdibs.com"); | |
| driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS); | |
| Object response = js.executeAsyncScript( | |
| "var callback = arguments[arguments.length - 1];" + | |
| "var xhr = new XMLHttpRequest();" + | |
| "xhr.open('GET', 'https://qa.1stdibs.com/soa/solr/1stdibs/select?q=category_search%3A1&rows=0&wt=json&indent=true&facet=true&facet.field=l3_facets&facet.limit=100000&fq=seller_pk:f_9534', true);" + | |
| "xhr.onreadystatechange = function() {" + | |
| " if (xhr.readyState == 4) {" + | |
| " callback(xhr.responseText);" + | |
| " }" + | |
| "};" + | |
| "xhr.send();"); | |
| try { | |
| JSONObject json = new JSONObject((String) response); | |
| System.out.println(json.toString()); | |
| } catch (JSONException e) { | |
| throw new PendingException("JSON did not work: " + e.getMessage()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment