GithubHelp home page GithubHelp logo

Comments (4)

mark-adams avatar mark-adams commented on July 3, 2024

That seems strange. Can you include your Dockerfile, your test script, and the docker command that you're using to execute it so that I can help more?

from docker-chromium-xvfb.

herryliq avatar herryliq commented on July 3, 2024

I had a same problem, I had solved with follows script in Dockerfile:
export DISPLAY=:1
Xvfb $DISPLAY -ac -screen 0 1280x1024x8 &
sleep 1

the stackoverflow url:
http://stackoverflow.com/questions/25731647/protractor-sendkeys-not-working-an-x-display-is-required-for-keycode-conversion

from docker-chromium-xvfb.

mark-adams avatar mark-adams commented on July 3, 2024

I tested this with the latest images on my sample applications (samples/python2, samples/python3) and everything appears to be working fine.

@rogthedodge, without a copy of your Dockerfile and script, I'm not sure there's much more to do on this one. Please reopen if you still are experiencing the issue.

from docker-chromium-xvfb.

chatrapathik avatar chatrapathik commented on July 3, 2024

Hii adams,

  • When I ran selenium test case using docker i got this error:

======================================================================
ERROR: test_google_title_matches_correct_value (test_google.ExampleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_google.py", line 13, in test_google_title_matches_correct_value
    input_box.send_keys('apple', Keys.RETURN)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 349, in send_keys
    'value': keys_to_typing(value)})
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 493, in _execute
    return self._parent.execute(command, params)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: an X display is required for keycode conversions, consider using Xvfb
  (Session info: chrome=57.0.2987.98)
  (Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 3.13.0-38-generic x86_64)


----------------------------------------------------------------------
Ran 1 test in 14.391s

FAILED (errors=1)

  • This is my docker file code:
 FROM markadams/chromium-xvfb
 
 RUN apt-get update && apt-get install -y \
     python python-pip curl unzip libgconf-2-4
 
 RUN pip install pytest selenium
 
 ENV CHROMEDRIVER_VERSION 2.28
 ENV CHROMEDRIVER_SHA256 8f5b0ab727c326a2f7887f08e4f577cb4452a9e5783d1938728946a8557a37bc
 
 RUN curl -SLO "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" \
   && echo "$CHROMEDRIVER_SHA256  chromedriver_linux64.zip" | sha256sum -c - \
   && unzip "chromedriver_linux64.zip" -d /usr/local/bin \
   && rm "chromedriver_linux64.zip"
 
 RUN mkdir chatra
 ADD . chatra/
 WORKDIR chatra/
 CMD python -m unittest -v test_google
 
 

  • This is my test case:
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class ExampleTests(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome('/usr/local/bin/chromedriver')

    def test_google_title_matches_correct_value(self):
        self.driver.get("http://www.google.com")
        input_box = self.driver.find_element_by_id('lst-ib')
        input_box.send_keys('apple', Keys.RETURN)
        assert "Google" in self.driver.title
        self.driver.save_screenshot('google.png')

    def tearDown(self):
        self.driver.close()
                                                                     
  • How can we resolve the above issue? And how can we use chrome driver version (2.29).

from docker-chromium-xvfb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.