Answer the question
In order to leave comments, you need to log in
How to instantly enter text after page load?
Welcome all!
There is a site and you need to make it so that when the page loads to fill in the data on sending, the data is automatically inserted there.
My following code is written in puppeteer. I tried many approaches, tried to change the value on load (nothing is inserted), searched for the selector and sent the value there (also empty fields), now my code automatically fills each field separately after loading.
Here is the code:
await page.goto("https://www.adidas.ru/delivery", {waitUntil: 'domcontentloaded'}); //Переход к оформлению
await page.waitForXPath("/html/body/div[2]/div/div[1]/div/div/div/div[2]/div/main/form/div/div/div/div[10]/div/div/div[1]/input", {timeout: 7000});
await page.type("input[data-auto-id='shippingAddress-firstName']", firstName); //Заполнение данных отправки
await page.type("input[data-auto-id='shippingAddress-lastName']", lastName);
await page.type("input[data-auto-id='shippingAddress-city']", city);
await page.type("input[data-auto-id='shippingAddress-zipcode']", postalCode);
await page.type("input[data-auto-id='shippingAddress-address1']", street);
await page.type("input[data-auto-id='shippingAddress-houseNumber']", houseNumber);
await page.type("input[data-auto-id='shippingAddress-phoneNumber']", phoneNumber);
await page.type("input[data-auto-id='shippingAddress-emailAddress']", emailAddress);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question