2

so I was trying to debug the tests we have running django/phantomjs/selenium-webdrive with ipdb, but the interactive debugger input was too slow, I need to hold a key for 3-5 seconds to get that character written down.

so I tracked it down and find out it was happening right after initiating phantomJS

Code

class IntegrationTest(StaticLiveServerTestCase):

    serialized_rollback = False

    @classmethod
    def setUpClass(cls):
        # this will be executed at the start of IntegrationTest
        super(IntegrationTest, cls).setUpClass()
        import ipdb; ipdb.set_trace()
        cls.driver = webdriver.PhantomJS("node_modules/phantomjs-prebuilt/bin/phantomjs") # input speed = normal
        cls.driver.set_window_size(1440, 900) # input speed = need to hold key 3-5 seconds
        cls.commonOp = commonOp(cls.driver, cls.live_server_url + settings.STATIC_URL + 'index.html')
        cls.customDriver = customDriver(cls.driver)

    @classmethod
    def tearDownClass(cls):
        # this will be executed at the end of IntegrationTest

IPDB

> /project/bx/integration_test/tests.py(20)setUpClass()
     18         super(IntegrationTest, cls).setUpClass()
     19         import ipdb; ipdb.set_trace()
---> 20         cls.driver = webdriver.PhantomJS("node_modules/phantomjs-prebuilt/bin/phantomjs")
     21         cls.driver.set_window_size(1440, 900)
     22         cls.commonOp = commonOp(cls.driver, cls.live_server_url + settings.STATIC_URL + 'index.html')

ipdb> n <- INPUT SPEED = NORMAL
> /project/bx/integration_test/tests.py(21)setUpClass()
     19         import ipdb; ipdb.set_trace()
     20         cls.driver = webdriver.PhantomJS("node_modules/phantomjs-prebuilt/bin/phantomjs")
---> 21         cls.driver.set_window_size(1440, 900)
     22         cls.commonOp = commonOp(cls.driver, cls.live_server_url + settings.STATIC_URL + 'index.html')
     23         cls.customDriver = customDriver(cls.driver)

ipdb> <- INPUT SPEED = SLOW! (3-5 seconds hold on key)

How can I fix this? Why is it happening?

Edit: I even tried using IPython when debugging to see if the input speed issue goes away, failed attempt.

EDIT: REPRO STEPS

in order to reproduce the same issue install phantomjs and selenium for python

$ pip install selenium
$ npm -g install phantomjs-prebuilt
$ python
>>> from selenium import webdriver
>>> webdriver.PhantomJS('/usr/local/bin/phantomjs')
>>> #try to type here.
Abdallah Alsamman
  • 1,623
  • 14
  • 22
  • 1
    I've changed and tested my code to use Firefox() with no lag so this is definitely a phantomjs specific issue – user1071182 Mar 27 '17 at 07:35
  • @user1071182 I was able to solve it by actually pressing and holding any letter while on ipdb interactive shell, until the input speed got normal... tell me if you need more help with that :D – Abdallah Alsamman Mar 27 '17 at 07:40
  • This is a very weird bug. I'm just using a regular python console, but when I hold down a key it will alternate printing quickly/normally for a few milliseconds and then pause for a few milliseconds then quickly then pause etc. – user1071182 Mar 27 '17 at 08:02
  • @user1071182 exactly, keep doing it until its fixed, it might take some 40 secs of holding a key... – Abdallah Alsamman Mar 27 '17 at 10:06
  • Same here, but I've noticed it's not about timing. Actually only one key works every 2-3 presses. Like, two key presses are ignored, and the third actually works. Another important thing is that it only happens to npm-installed PhantomJS. When installed via apt-get (ubuntu) all works normally. – augustomen Feb 03 '18 at 14:30

0 Answers0