I am working on automation on a chat application and i want to send/receive messages, is it possible by using Appium? Also Is it possible to pause the Appium while it is running, and is it possible to send a request to web services through Appium scripts? please suggest
1 Like
Yes, you can call web services through appium scripts.
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//add reuqest header con.setRequestMethod("GET");
int responseCode = con.getResponseCode(); System.out.println("\nSending 'GET' request to URL : "+ url); System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close();
//print result System.out.println("Request response:: "+response.toString());