Automatic inputs in Chromium are filled randomly

80 views Asked by At

Automatic inputs in Chromium are filled randomly

CASE

I want to simulate a barcode scanner without any hardware attached to my computer. From what I learnt, barcode scanners behave as keyboards, so I want to simulate a keyboard HID device.

ENVIRONMENT

Chromium version 53.0.2785.143 Built on Ubuntu , running on LinuxMint 17.2 (64-bit)

ATTEMPTS

1) evdev in python

2) write into dev/input/event* using C++

3) pyautogui

Attempts 1 and 2 behave similarly. Both try to write into dev/input/event* file which corresponds to computer keyboard. But for multiple keypress in loop, the result is not what I expect: if I simulate a keypress repetition, the result goes randomly. Furthermore, some keyboard keys start printing another character which does not correspond to them until the terminal is closed.

So I went with attempt 3 which prints what I want, but the result goes randomly in Chromium.

PROBLEM

pyautogui works in Firefox, but writes randomly inputs in Chromium. It looks like Chromium are avoiding automatic input in its input forms in any website.

Python program:

import pyautogui

pyautogui.typewrite('1234567890123\n', interval=0)

Example

It prints 1234567890123 in Firefox;

It prints 2413123098765 in Chromium. #Random number of 13 digits

QUESTION

Does anybody know why Chromium behaves like that?

0

There are 0 answers