dequelabs / axe-cli

[Deprecated] A command-line interface for the aXe accessibility testing engine
Mozilla Public License 2.0
430 stars 35 forks source link

Fix axe-cli for release #5

Closed marcysutton closed 7 years ago

marcysutton commented 7 years ago

I couldn't run axe-cli at all without these changes–I kept running into Issue #3 and the only way to fix it was to remove the call to config.driver.quit() in lib/webdriver.js. I couldn't find a way to check for a driver session id before making that call, so the solution was to remove it since it threw an error in .catch(e) in axe-test-urls.js:77, even after results had successfully completed:

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
    at ClientRequest.<anonymous> (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/http/index.js:238:15)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1276:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
From: Task: WebDriver.quit()
    at WebDriver.schedule (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/webdriver.js:816:17)
    at WebDriver.quit (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/webdriver.js:849:23)
    at stopDriver (/Users/marcysutton/Sites/Deque/axe-cli/lib/webdriver.js:39:17)
    at testPages (/Users/marcysutton/Sites/Deque/axe-cli/lib/axe-test-urls.js:26:3)
    at /Users/marcysutton/Sites/Deque/axe-cli/lib/axe-test-urls.js:80:5
    at ManagedPromise.invokeCallback_ (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/promise.js:1366:14)
    at TaskQueue.execute_ (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/promise.js:2970:14)
    at TaskQueue.executeNext_ (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/promise.js:2953:27)
    at asyncRun (/Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/promise.js:2813:27)
    at /Users/marcysutton/Sites/Deque/axe-cli/node_modules/selenium-webdriver/lib/promise.js:676:7

Removing that call didn't seem to affect the functionality: I could run axe-cli on multiple URLs and it returned results successfully, multiple times in a row. I think when you kill off Phantomjs it takes down the driver anyway, so there is nothing left running on port 4444.

I also added a fix for the Selenium URL since it would return an HTML error page on the Selenium website otherwise.

Closes #3.

marcysutton commented 7 years ago

@WilcoFiers @iandotkelly I ran this on another machine and it only worked with my PR. I think we should merge it