Home / Companies / New Relic / Blog / Post Details
Content Deep Dive

Setting cookies in synthetic monitors using CDP

Blog post from New Relic

Post Details
Company
Date Published
Author
Steve Cunnew, Technical Success Manager
Word Count
1,345
Language
English
Hacker News Points
-
Summary

In the realm of scripted browser monitors, managing cookies can streamline processes by eliminating the need to script actions like accepting cookie modals or handling multi-factor authentication (MFA). Using methods such as addCookie() from $webDriver.manage() or the Network.setCookie method available through the Chrome DevTools Protocol (CDP), users can set cookies to bypass these common interruptions, reducing complexity in browser automation tasks. The CDP, accessible through a connection established with Selenium's createCDPConnection() function, facilitates setting cookies without user interface intervention and can also be leveraged to capture other data for observability purposes. The blog emphasizes the importance of using secure credentials for cookies and highlights the optional use of event listeners for debugging. It concludes by encouraging readers to engage with the Explorers Hub for further discussion and support, noting that the views expressed are those of the author, Steve Cunnew, and not necessarily representative of New Relic.