facebookarchive / huxley

A testing system for catching visual regressions in Web applications.
Apache License 2.0
4.07k stars 286 forks source link

Huxley execution not working on Mac #59

Open guillemhs opened 10 years ago

guillemhs commented 10 years ago

Hi,

Having the toggle app running, I executed the the following Huxley command and I get the following output.

[will@Rebecas-MacBook-Air examples (master ✗)]$ huxley --playback

Running Huxley file: Huxleyfile

[toggle] Running test: toggle Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run self.target(_self.__args, *_self.kwargs) File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/huxley/threadpool.py", line 32, in thread func(_args, *_kwargs) File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/huxley/cmdline.py", line 81, in run_test screensize=screensize File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/huxley/main.py", line 83, in main d = webdriver.Remote(remote, CAPABILITIES[browser]) File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 72, in __init self.start_session(desired_capabilities, browser_profile) File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 114, in start_session 'desiredCapabilities': desired_capabilities, File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 165, in execute self.error_handler.check_response(response) File "/usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response raise exception_class(message, screen, stacktrace) WebDriverException: Message: None ; Stacktrace:

Any ideas why Huxley is not working?

petehunt commented 10 years ago

Do you have firefox installed?

eantz commented 10 years ago

Hi

I'm on Windows and recently fresh install huxley

I have the same error

I have firefox installed although it's not my default browser.

Any ideas?

Edit

I did simple workaround to get this error away by comment some codes in C:\Python27\Lib\site-packages\huxley\main.py (line 82,83,84)

        #if remote:
        #    d = webdriver.Remote(remote, CAPABILITIES[browser])
        #else:
        d = DRIVERS[browser]()

It seems that huxley force to open remote webdriver, even if remote option is set to None or False

Next

I run huxley --record again, error is gone, browser come up, show blank page, and hanging for a while then close by it will with this error message in huxley console :

huxley --record
-------------------------------
Running Huxley file: Huxleyfile
-------------------------------
[toggle] Running test: toggle
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
    self.run()
  File "C:\Python27\lib\threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Python27\lib\site-packages\huxley\threadpool.py", line 32, in thread
    func(*args, **kwargs)
  File "C:\Python27\lib\site-packages\huxley\cmdline.py", line 69, in run_test
    screensize=screensize
  File "C:\Python27\lib\site-packages\huxley\main.py", line 85, in main
    d = DRIVERS[browser]()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 60, in __init__
    self.binary, timeout),
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 61, in launch_browser
    self._wait_until_connectable()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 105, in _wait_until_connectable
    self.profile.path, self._get_firefox_output()))
WebDriverException: Message: "Can't load the profile. Profile Dir: c:\\users\\fo
rmul~1\\appdata\\local\\temp\\tmpmciuy7 Firefox output: 1405577940382\taddons.xp
i\tDEBUG\tstartup\r\n1405577940383\taddons.xpi\tDEBUG\tSkipping unavailable inst
all location app-system-local\r\n1405577940384\taddons.xpi\tDEBUG\tSkipping unav
ailable install location app-system-share\r\n1405577940387\taddons.xpi\tDEBUG\tc
heckForChanges\r\n1405577940410\taddons.xpi\tDEBUG\tNo changes found\r\n*** Bloc
klist::_loadBlocklistFromFile: blocklist is disabled\r\nJavaScript error: chrome
://browser/content/urlbarBindings.xml, line 651: aUrl is undefined\r\nJavaScript
 error: chrome://browser/content/urlbarBindings.xml, line 651: aUrl is undefined
\r\n"

For now, I can't solve this error myself.

Any suggestion will be very appreciated.

eantz commented 10 years ago

Update

I don't know if it is a firefox problem, but it runs in chrome.

But, I made minor changes to these file to make it work in addition to my previous change above.

main.py

#line 67
browser='chrome',

....

#line102-105
            #if local:
            #    local_d = webdriver.Remote(local, CAPABILITIES[browser])
            #else:
            local_d = d

I change the option here because it doesn't work when I change in the Huxleyfile

Then I copied chromedriver.exe to C:\Python27\Lib\site-packages\selenium\webdriver\chrome\ and made a small change to this

C:\Python27\Lib\site-packages\selenium\webdriver\chrome\webdriver.py

#line 32
def __init__(self, executable_path="C:\Python27\Lib\site-packages\selenium\webdriver\chrome\chromedriver", port=0,

I hardcoded the executable_path here

Note : I'm not familiar with python, so this is my best effort so far :grin:

Now, I can record and playback test using chrome. But although the test recorded successfully, it always throw this error after that

Test recorded successfully
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
    self.run()
  File "C:\Python27\lib\threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Python27\lib\site-packages\huxley\threadpool.py", line 32, in thread
    func(*args, **kwargs)
  File "C:\Python27\lib\site-packages\huxley\cmdline.py", line 69, in run_test
    screensize=screensize
  File "C:\Python27\lib\site-packages\huxley\main.py", line 137, in main
    return 0
  File "C:\Python27\lib\contextlib.py", line 154, in __exit__
    self.thing.close()
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 445, in close
    self.execute(Command.CLOSE)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 165, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py"
, line 164, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'no such session\n  (Driver info: chromedriver=2.9
.248315,platform=Windows NT 6.1 SP1 x86_64)'

Then when I run the playback, it always say that Test failed, rerecording... after taking the first screenshot.

Okay, now I will use it to my real project. But, still hoping that someone clean this up..

Cheers...

barrymcgee commented 10 years ago

I have this same problem on OSX 10.9.4 with Firefox 30 - any ideas?

chenglou commented 10 years ago

Random plug! @petehunt is super busy nowadays. I maintain a node port here. There are a few differences, but give it a try if you want!