Setup:
I have a Python/Selenium/Chromedriver script on the Debian machine that does data entry to text boxes on a web page. The code that is failing is very simple:
element = browser.find_element_by_path('//input[@name="ReqDocID"]')
element.clear()
element.send_keys(doc_id) # doc_id is a 3 character string
When I set up a VNC session to Debian from the Windows machine and run the script from an xterm on the X-windows desktop, characters in doc_id are randomly dropped. Adding delays between entries did not make any difference. The web page does not modify the contents of the text box during entry using JS. The problem occurs using both Chrome and headlesschrome. I verified that I had a new version of chromedriver (fixed a drop key issue) and that my keyboard is set for English to avoid another known issue.
Finally after several hours of troubleshooting I found something interesting. If I use Putty on the Windows box to ssh into Debian directly (no X-windows, no VNC) and then run the script it works perfectly. When I run the same script from the VNC desktop it fails every time due to characters being dropped.
Does anyone have an idea why running the script over a VNC connection should make a difference? Thanks!
There is an open bug for TightVNC related to sending keys in chromedriver. Issue 1509: TightVNC: sendKeys()
As a workaround suggested in the discussion, it's not reproducible on vnc4server. You can try that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With