skip to Main Content

Can you reference a variable dynamically using JavaScript for Playwright

I have a JSON file that I'm reading data from for a Playwright test as below: async answerMyDetails(){ const testDataFile = './myJsonFile.json' let data = await fs.readFile(testDataFile) let testData = await JSON.parse(data) await this.page.locator(`div:has(> label:has-text("Some Text")) input`).fill(`${testData.myDetailsPageQuestions.vehicleReg.answer_fullUkLicence_carInsurance}`) } I'd like…

VIEW QUESTION
Back To Top
Search