So I am trying to automate the process of filling out a webform on https://www.business.att.com/disconnects/.
I am using the Playwright test tool to automate this process using JavaScript
I have the steps outlined in Playwright:
const { test, expect } = require('@playwright/test');
test('filling out ATT disconnect webform', async ({ page }) => {
await page.goto('https://www.business.att.com/disconnects/');
await page.click('select[name="region"]');
await page.selectOption('select[name="region"]', "ES");
await page.selectOption('select[name="service"]', 'ZH:E2');
await page.click('text=Desired Disconnect Date');
// This RequestedDisconnectDate is one of the values I want to pull from a local csv. I have it hard coded for now
await page.fill('input[name="RequestedDisconnectDate"]', '01/12/2022');
await page.click('a:has-text("12")');
// For "Disconnect Reason", ALWAYS select = "Other"
await page.click('select[name="ReasonForDisconnect"]');
await page.selectOption('select[name="ReasonForDisconnect"]', '31');
// For "Reason Other", ALWAYS fill = "Other"
await page.click('input[name="ReasonForDisconnectOther"]');
await page.fill('input[name="ReasonForDisconnectOther"]', 'Other');
// ...
await page.click('input[alt="Submit"]');
});
Some of the values I am trying to pass in are constant but others are variable. For example, the RequestedDisconnectDate is stored in a csv. Those values I want to pull from a csv I have saved on my computer locally. But I am not sure how to go about that process. I have been looking at js library solutions and npm packages like csv-parser, and jquery. But I am not sure how to work it out.
If someone could give me an idea on how to approach this that would be much appreciated. thanks