my code is as follows
await page.waitForTimeout(1000);
await page.waitForSelector(
"#yDmH0d > c-wiz > div > div.WFnNle > c-wiz > div.OlSOob > c-wiz > div.ccvoYb.EjH7wc > div.AxqVh > div.OPPzxe > c-wiz.rm1UF.UnxENd.u3bW4e > span > span > div > textarea"
);
let sourceString = "ni hao ma";
await page.type(
"#yDmH0d > c-wiz > div > div.WFnNle > c-wiz > div.OlSOob > c-wiz > div.ccvoYb.EjH7wc > div.AxqVh > div.OPPzxe > c-wiz.rm1UF.UnxENd.u3bW4e > span > span > div > textarea",
sourceString
);
await page.waitForTimeout(5000);
await page.waitForSelector(
"#yDmH0d > c-wiz > div > div.WFnNle > c-wiz > div.OlSOob > c-wiz > div.ccvoYb.EjH7wc > div.AxqVh > div.OPPzxe > c-wiz.P6w8m > div.tm8pq"
);
const [val1] = await page.$x(
'//*[@id="yDmH0d"]/c-wiz/div/div[2]/c-wiz/div[2]/c-wiz/div[1]/div[2]/div[3]/c-wiz[2]/div[7]/div/div[1]/span[1]/span/span'
);
const txtval1 = await val1.getProperty("textContent");
const rawtxtval1 = await txtval1.jsonValue();
console.log(rattxtval1);
this code opens google translate, types in some text, in this case "ni hao ma" and returns the translation of it. All of this works perfectly but only if I click the first box myself. For some reason, I cannot get it to enter the text without me clicking the box. I have tried to call page.click() on the box with the same tag, and it says the node does not exist as shown in the error below
Error: No node found for selector: #yDmH0d > c-wiz > div > div.WFnNle > c-wiz > div.OlSOob > c-wiz > div.ccvoYb.EjH7wc > div.AxqVh > div.OPPzxe > c-wiz.rm1UF.UnxENd.u3bW4e > span > span > div > textarea
yet when I click it myself as the program runs, it then types in the box perfectly (using the exact same tag to find which box to type into) and retrieves the text in the other box too.
Am I using the wrong function or am I completely missing a step of what's going on?
Any help greatly appreciated.