Inactive conveyor sending keys: x-display required for code key conversion

I am trying to run Protractor e2e tests inside a Vagrant VM using a headless Chrome. I managed to get it to work using Xvfb, but when I run the test to fill out the form, I get an error: unknown error: X-display is required to convert the code keys, think about using Xvfb

All tests run fine, but as soon as I use getKeys () (e.g. element (by.model ('user.email')). SendKeys ('admin');) I get this error, although I'm already using Xvfb.

I run:

  • AngularJS sample application created by Yeoman angular generator - full glass
  • Nodejs version 0.10.30 installed with nvm
  • Vagrant 1.6.3
  • VirtualBox 4.3.14
  • Host OS Ubuntu 14.04 32 bit
  • Ubuntu guest OS 14.04 32 bit
  • chrome 37.0.2062.94
  • chromedriver 2.10.267517

I use the following shell script to run Selenium and Xvfb:

#! / Bin / w

webdriver-manager start &

Xvfb: 1 -ac-screen 0 1280x1024x8 &

export DISPLAY =: 1

I also added "export DISPLAY =: 1" to / opt / google / chrome / google -chrome. Again, tests without sendKeys () work fine.

What i have done so far:

  • I am running 32 bits of Ubuntu, so I downloaded chromedriver 2.10 32 bits, but that didn't help
  • I ran a chrome reverse with --verbose and checked the logs, but this only shows the same error
  • I searched for Xvfb screen size settings, didn't help
  • I checked several source codes here: https://github.com/bayandin/chromedriver/blob/master/keycode_text_conversion_x.cc and found the error message on line 196. It fires when the gfx :: GetXDisplay () command (line 193) does not receive the display object. I suspect that this can only be the DISPLAY variable that I export to / opt / google / chrome / google -chrome, but I'm not sure and have no idea how to fix it.

I would like to know how I can get sendfkeys () working with Chrome headless inside Vagrant VM. Any help is appreciated.

+5
source share
1 answer

Provide seleniumAddress: 'http: // localhost: 4444 / wd / hub' matches your selenium server and do not install chromeOnly since then to avoid using a headless selenium server.

In addition, Xvfb should run before webdriver-manager , and you are missing xvfb-run if you think you need it to perform the X authority dance for you:

 #!/bin/sh export DISPLAY=:1 Xvfb $DISPLAY -ac -screen 0 1280x1024x8 & sleep 1 xvfb-run webdriver-manager start & 

In case you are interested, I configured the solution without a docking station on the docker with additional VNC access and video recording: https://github.com/elgalu/docker-selenium

+3
source

Source: https://habr.com/ru/post/1202100/


All Articles