If you are using WebDriver or learning how to use Selenium for test automation, you must be using some programming language like Java or PHP, etc. for automation and performing actions on browsers like Chrome. But in this article we are not going to use WebDriver Client Like Java or PHP, etc. and we will perform actions like open URL, Click Button or Enter Text using ChromeDriver and PostMan tool.
- Postman Chrome Plugin
- Postman Chrome App
- Download Postman For Windows 10
- Postman Interceptor Chrome
- Postman Tool Download For Windows
I am going to use JSON Wire Protocol for driving chrome driver. You can read more in details about what is JSON Wire Protocol in my old posts.
Download ChromeDriver and PostMan
The first step is to download the ChromeDrive executable from Google ChromeDriver Page.If you already have ChromeDriver downloaded, you can use the same executable. I am going to use the ChromeDrive for MAC OS here in this article. Windows users can also download the .exe file and perform all the steps.
We also need to download Postman. PostMan is a super cool tool for API development. You can send and receive API request from PostMan. you can read more about Postman Download Page.
Start ChromeDriver on Terminal:
After downloading ChromeDriver we need to first start the ChromeDriver executable on the local machine.
Now we have a successfully running ChromeDriver. Please pay attention to the port no in the Starting message of ChromeDriver. It always starts on 9515 by default and start listening on the same port.
Open Google Chrome Browser:
Postman automatically downloads minor updates and bug fixes. Postman Chrome app (deprecated) The Postman Chrome app is deprecated—if you're using the Chrome app, you can retain your data when you switch to the native app either by syncing with a Postman account you're signed into, or by exporting from Chrome and importing into the native app.
Now open Postman which is installed on your machine and you should make a POST call to ChromeDriver.
![Postman Postman](/uploads/1/2/6/5/126578820/381533051.png)
POST:
http://localhost:9515/session
If you are using the Postman web client, you will need to also download the Postman desktop agent. The Postman agent overcomes the Cross Object Resource Sharing (CORS) limitations of browsers, and facilitates API request sending from your browser version of Postman. Download Desktop Agent: macOS Linux Windows 64-bit Windows 32-bit. 2) After the setup is downloaded, unzip the setup: unzip -q Postman-mac.zip 3) Install the application: open Postman.app 4) To uninstall the application: sudo rm -rf Postman.
Request Body:
Postman Chrome Plugin
Response:
You should save the SessionID from the Response you received as we are going to need SessionID for further communication.
Now let’s redirect to the URL:
Now As you can see the ChromeBrowser is open and ready to open any URL.We need to do POST call again with the session ID which we saved from our last API response.You can replace the sessionID which I have used within the request.
Example:
http://localhost:9515/session/:SessionID/url
Post:
http://localhost:9515/session/05567e0fc54f5859a7418632a8988cc7/url
![Postman Postman](/uploads/1/2/6/5/126578820/657832122.png)
Request Body:
Response:
Now let’s find an Element on the page:
Postman Chrome App
Now we have the URL opened in our chrome browser and lets find the search textBox from the page in our next request.
Download Postman For Windows 10
Post:
http://localhost:9515/session/05567e0fc54f5859a7418632a8988cc7/element
Request Body:
Response:
You should save the ELEMENT value from the response as this is the Element ID and we need to pass this in next request
Now let’s send the value “Chrome” to this search Element textBox:
Now we have received the elementID of the SearchTextBox and now we can send any Text to this TextBox using the POST call.
Example:
http://localhost:9515/session/:sessionID/element/:elementID/value
Post:
http://localhost:9515/session/05567e0fc54f5859a7418632a8988cc7/element/0.1450256429796304-1/value
Request Body:
Response:
Now Quit Driver instance:
Now to Quit Driver session and close the Chrome Browser, we should send the DELETE request with the session ID.
DELETE:
http://localhost:9515/session/05567e0fc54f5859a7418632a8988cc7
Response:
Postman Interceptor Chrome
I have used JsonWireProtocol standards about requests to perform few actions on the browser. You can try to perform more actions using the PostMan tool.
If you don’t want to use PostMan tool for API requests and you can use Java as programming language with any HTTPClient available.
Postman Tool Download For Windows
Thanks for reading!