Image CAPTCHA
Enter the characters shown in the image.

You are here

How to Automate HTTPS Rest Calls using Selenium, Why??

1 post / 0 new
SiteAdmin
SiteAdmin's picture
How to Automate HTTPS Rest Calls using Selenium, Why??

Let's say that you need to automate file upload with Secured HTTPs Rest calls using selenium. 

You might get the following error:

Remote host closed connection during handshake
Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

Here some of the code to use, to solve this issue:

#HTTPS path
String urlPath = "#https://xx.xx.xx.xxx:xxxx/<API PATH>";
String json = "<JSON String>";
URL url = new URL(urlPath);
HttpsURLConnection connection = null;
connection = (HttpsURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type","application/json");
connection.setRequestProperty("Accept", "application/json");
OutputStreamWriter streamWriter = new OutputStreamWriter(connection.getOutputStream());

This, of course, won't work, why?

1. Try to send your RSA key by overriding transport layer and also pass your certificate as an argument.

2. Selenium is a wrong tool for API automation - you should try Rest Assured framework. Try jayway.RestAssured library to automate. You can also integrate it with Selenium

3. You can use HTTPClient API to automate rest API testing.

4. You can also use rest assured API (best for rest API) to automate web services. It works in BDD style and quite easy to implement.

5. You must add authentication ticket to establish the connection..check which services you are using in your project for authentication.

So, don't break your head - ask community

If you need to combine web service testing with functional testing, what is your first choice??

 

I found good article for Web services testing in the following link: How to perform Web Services Testing using HTTPClient

(if you have good links for Web services testing, please comment) Cool

MANUFACTURERS Wallboard

Testing tool manufacturers world-wide list
10Levels ABID CONSULTING AccelQ Accord Software ActiMind AdaCore
AdaLog AgileLoad AgileWay Agitar Algorismi ALL4TEC
Andreas Kleffel Android Apache Apica Apollo Systems AppAssist.mobi
Applitools AppPerfect Appsee ApTest Assertible Assure
Atlassian AutoIt Consulti .. Automation Anyw .. Automation Cons .. Axosoft Aztaz Software
Backtrace I/O Badboy BlazeMeter Borvid BrowserStack BSQUARE
BStriker Intern .. CA Technologies Canonical Canoo Engineeri .. Catch Software CelestialTeapot
Chris Mallett Cleanscape ClicTest CloudQA Codeborne CodeCentrix
CodePlex projec .. Codoid Cogitek Compuware Configure IT Conflair
ConSol Core Services Coronys Ltd Countersoft CresTech Softwa .. CrossBrowserTes ..
Crosscheck Netw .. Crowdsourced Te .. Cucumber Ltd Cyara Cygnet Infotech DareBoost
Databene Datamatics Glob .. DevExpress DTM soft Dynatrace LLC EasyQA
Eclipse EkaTechserv Elvior Emmanuel Jorge Empirix EPAM Systems
Equafy Esterel Technol .. eXept Software .. Experitest Finaris Froglogic
FrontEndART Ltd GeneXus GitHub project gnoso Google Code Pro .. GrammaTech
Gurock Software HelpSystems HENIX Hewlett Packard .. Hexawise High-Tech Bridg ..
Hiptest Hitex IBM Rational imbus Shanghai Impetus Inflectra
informUp InTENSO - IT Ex .. Ipswitch Jamo Solutions Janova JAR Technologie ..
JBoss Developer jClarity Jellly.io JetBrains Jively jQuery foundati ..
JS Foundation Jspresso Kanoah KMS Technology Kualitee LDRA Limited
Litmus LoadFocus Loadster Perfor .. MarathonITE Marketcircle Marketcircle
Maveryx Meliora Ltd Micro Focus Sof .. Microsoft Mobile Labs Mobile1st
Mockaroo, LLC Monkop Mozila MSys Technologi .. Navicat NeoTys
Neowise Softwar .. NetCart NORIZZK.COM Novosync Mobili .. NRG Global NTT Resonant
OC Systems Odin Technology OpCord Oracle Orcanos Original Softwa ..
OW2 PANAYA Parasoft PassMark Patterson Consu .. Perfecto Mobile
Pivotal, Inc. Plutora Postman (API To .. PractiTest PrimaTest Process One
Programming Res .. Psoda PureLoad PushToTest Python Q-Assurance
QA Systems QACube QASymphony QAWorks QMetry Quali
Qualitia Softwa .. Quality First S .. Quotium RadView Softwar .. Ranorex RedLine13
Reflective Solu .. ReQtest RevDeBug Robotium Tech Rogue Wave Soft .. Rommana Softwar ..
RTTS ruby-doc.org Runscope Sandklef GNU La .. Sauce Labs Seapine Softwar ..
SeleniumHQ Sencha Sensiple Siemens PLM Sof .. SmartBear Softw .. SmarteSoft
SOASTA SoftLogica Softomotive Softsmith Solution-Soft SonarSource
Sourceforge Spirent Technol .. SQS Software Qu .. Square Stimulus Techno .. Swifting AB
Synopsys T-komp T-Plan TechExcel TechTalk Telerik By Prog ..
Tellurium Test Collab Test Goat Test Recon TestCaseLab testCloud.de Gm ..
TestCraft Techn .. Testenium Testim.io TestingBot TestLodge Testmunk
Testomato TestOptimal TestPlant TestPro Testuff The Core Bankin ..
The MathWorks The Open Group thePHP.cc Thoughtbot Thoughtworks Tigris.org
Time Simulator Top-Q Trace Technolog .. TrendIC TRICENTIS Tritusa Pty Ltd
TWD Solutions P .. TypeMock Tyto Software Ubertesters UniTESK Universal Test ..
Usetrace Ltd Utrecht Univers .. Validata Group Vanamco AG Vector Software Veracode
Verifaya Corpor .. Verit VersionOne Viewlike.us Vornex Inc. Watir.com
WcfStorm Soluti .. We Are Mammoth Web Performance .. Wintask Wireshark Found .. Worksoft
Xceptance XK72 Xpand IT XQual ZAPTEST Zeenyx Software ..
Zephyr Zeta Software zutubi pty

Selenium Youtube Playlist

Theme by Danetsoft and Danang Probo Sayekti