# Writing a test on an alert from inspecting an element

**URL:** <https://community.postman.com/t/writing-a-test-on-an-alert-from-inspecting-an-element/24369>\
**Category:** Help Hub\
**Tags:** tests, javascript\
**Created:** [June 1, 2021, 6:58pm UTC](https://community.postman.com/t/writing-a-test-on-an-alert-from-inspecting-an-element/24369 "2021-06-01T18:58:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkruep](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@bkruep](https://community.postman.com/u/bkruep)\
**Post date:** [June 1, 2021, 6:58pm UTC](https://community.postman.com/t/writing-a-test-on-an-alert-from-inspecting-an-element/24369/1 "2021-06-01T18:58:07Z")

</div>

Hello I am not sure if this is possible or not as I am new to Postman but wanted to check. I am trying to write a test to confirm that a particular audit message on a page displays. I tried to get the audit message to return on a POST request and it does not. So I inspected the element and this is the alert that I want to write a test for:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/7/677a7aec1d0e91c6a7ffb9cc4591d2d3acbc3fb4.png)

When I use the response body to test messages its real simple and just use the following (just trying to show that I know how to display page message):

tests[“Request routes to Margin Advanced”] = responseBody.has(“Margin Approval Advanced - Check”);

Does anyone know if there is any javascript code that I can run to create this test? I am currently learning the language on Linkedin Learning so do have some basic knowledge but that is very limited still at this point.

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [June 2, 2021, 8:34am UTC](https://community.postman.com/t/writing-a-test-on-an-alert-from-inspecting-an-element/24369/2 "2021-06-02T08:34:03Z")

</div>

🤗There are code snippet that will generate test code for you postman test script section , see the response body contains snippet .
