0
votes

I'm trying to simplify my Selenium tests by running headless alongside my test suite on Docker. I'm running a Debian Jessie image with google-chrome-stable installed from PPA and chromedriver 2.33 installed. I've also attached /dev/shm to maximize my memory in the container. I've verified chromedriver runs fine inside of the container. However, when I run a simple test I get a timeout:

browser = Watir::Browser.new :chrome, headless: true
browser.goto 'google.com'
browser.text_field(title: 'Search').set 'Hello World!'
browser.button(type: 'submit').click
puts browser.title
browser.quit

/usr/local/lib/ruby/2.4.0/net/protocol.rb:176:in `rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
    from /usr/local/lib/ruby/2.4.0/net/protocol.rb:154:in `readuntil'
    from /usr/local/lib/ruby/2.4.0/net/protocol.rb:164:in `readline'
    from /usr/local/lib/ruby/2.4.0/net/http/response.rb:40:in 
......

One thing to mention is that chromedriver is installed at /chromedriver/chromedriver and then added to $PATH. Does Watir/Selenium need to know the full path of chromedriver? Does chromedriver or chrome need to be running in the background?

1
if you look further down that error message you should eventually find a reference to a line of your code, would be helpful to know what's on that line - Chuck van der Linden
No surprises here...code is included. - Ken J
You have included some of your code yes, but you have not indicated which line of your code is causing the error. The portion of the error dump that you included has only 4 lines, all of them core ruby networking code. That doesn't tell us what line of your code, when executed, is causing that error. - Chuck van der Linden

1 Answers

0
votes

That is because of a small shm (shared memory). This github link will solve your troubles. If you are curious what shm is refer to this nice guide.

Fast test can be done by using this command.

docker exec containerID umount /dev/shm
docker exec containerID mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm