question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having trouble with page.type not typing all characters

See original GitHub issue

Having some issues where it seems this.page.type is not working properly and I can’t figure out why. It works 100% of the time in one of my tests, but I have a second test doing the same thing on a different page (only difference is the new page has more input fields) and it fails most of the time (but occasionally passes). Here’s an example of what I’m doing:

await this.page.type('[placeholder="Enter ID"]', myObj.id);
await this.page.waitForSelector(`input[value="${myObj.id}"]`);

await this.page.type('[placeholder="Enter Type"]', myObj.type);
await this.page.waitForSelector(`input[value="${myObj.type}"]`);

I have 11 total input fields that follow the above pattern on this page, the page that has never flaked out on me has only 6 input fields.

The problem is page.type doesn’t appear to be typing everything in myObj, for example myObj.type contains 10 random words, occasionally puppeteer seems to only type some of the characters contained in myObj.type, it sometimes cuts off in the middle of a word, other times it cuts off at the end of a word. The property that doesn’t type out completely is random every run, as is the number of characters it actually types out. It is not a character limit in the database or input field (I can manually type in significantly more without a problem and each time I run it cuts off at a different random point, sometimes as few as 5-6 characters, other times as many as 20 or so characters).

Is there any debugging methods that would help me figure this out? Console logging myObj shows the full text for every property, taking screenshots or running puppeteer outside of headless mode shows that it stops inputting characters at random times.

Additionally I’ve tried adding a delay option into my page.type calls and it seems to make the issue worse, typing only a single character into my first input field before breaking. It seems like it might be losing focus (when watching it in headless: false mode).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:51
  • Comments:76 (16 by maintainers)

github_iconTop GitHub Comments

29reactions
Tzookcommented, Feb 12, 2018

Here’s a patch to overcome this method until it is fixed: await page.evaluate((text) => { (document.getElementById('my-input')).value = text; }, "text-to-inject");

25reactions
fringdcommented, Jan 4, 2019

Seems a lot of people are still seeing this. Can we re-open it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer input not typing all characters - Stack Overflow
I have some trouble with typing multi lines characters into a wysiwyg input. I use this code : await page.goto('https://someurl.com', ...
Read more >
Typing in Pages not working - Apple Support Communities
Typing in Pages not working. When I type in Pages, the characters don't appear. The cursor moves, but the letters don't show up....
Read more >
How to Fix Keyboard Typing Wrong Character or Keys Not ...
If still problem not fixed contact me on fb...https://www.facebook.com/mjtube11Keyboard codes...
Read more >
How to Solve Common Keyboard and Typing Problems
Here are answers to some of the most common typing problems, from disappearing text to jumping cursors.
Read more >
Some characters missing or cut off when displayed on screen ...
This problem may affect the following types of characters: ... the text of your document--for example, a picture that is not inserted in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found