I have a use case where I want to use synthetics to monitor a page, however this page has a URL which requires it to be updated daily with the days date. Kind of like: http://url/<today's_day(2021-10-25)>. Since it appears that synthetics accepts .js files for its sources. Does that mean regular JS can also be used within synthetics to do things like generate and modify values are run time, or is this not possible?
Hi Ben. You absolute can include custom logic in your synthetic scripts to suit your needs.
For example, you can write a step to navigate to a page with dynamic values.
step('Navigate to page', async () => {
const date = new Date();
await page.goto(`http://${date.getMonth()}-${date.getDay()}-${date.getFullYear()}`);
});
We know that many production synthetics scripts will require this type of dynamic logic. Hope this helps.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.