File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -251,3 +251,29 @@ stopListening command will retunrs an array of network details in the below JSON
251251]
252252```
253253
254+ ### Java Example
255+ ```
256+ JSONObject customObject = new JSONObject();
257+ customObject.put("url","/api/users?.*");
258+ customObject.put("responseBody","{\n" +
259+ " \"page\": 2,\n" +
260+ " \"per_page\": 6,\n" +
261+ " \"total\": 12,\n" +
262+ " \"total_pages\": 2,\n" +
263+ " \"data\": [\n" +
264+ " {\n" +
265+ " \"id\": 7,\n" +
266+ " \"email\": \"michael.test@reqres.in\",\n" +
267+ " \"first_name\": \"Michael\",\n" +
268+ " \"last_name\": \"Lawson\",\n" +
269+ " \"avatar\": \"https://reqres.in/img/faces/7-image.jpg\"\n" +
270+ " }\n" +
271+ " ]\n" +
272+ "}");
273+ JSONObject parentJson = new JSONObject();
274+ parentJson.put("config", customObject);
275+ driver.executeScript("interceptor: addMock",new JSONObject(parentJson));
276+ driver.findElement(By.xpath("//android.widget.TextView[contains(@text,'List')]")).click();
277+ ```
278+
279+
You can’t perform that action at this time.
0 commit comments