Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chrome driver path problem in Windows #416

Merged
merged 3 commits into from
Apr 25, 2017

Conversation

xjchengo
Copy link
Contributor

After install from souce in Windows, npm run demo throws:

21:13:29 ERR PuppetWebBrowserDriver initChromeDriver() Wechaty require `chromedriver` to be installed.(try to run: "npm
install chromedriver" to fix this issue)
21:13:29 ERR PuppetWebBrowser init() exception: The ChromeDriver could not be found on the current PATH. Please download
 the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be
found on your PATH.

I solved the problem in following steps:

  1. Check if chromedriver installed correctly: these is no error when npm install and PROJECT_ROOT\node_modules\chromedriver\lib\chromedriver\chromedriver.exe exists.
  2. Check if PATH wrong: npm run demo succeeded if adding PROJECT_ROOT\node_modules\chromedriver\lib\chromedriver dir to PATH env and failed if removing PROJECT_ROOT\node_modules\chromedriver\lib\chromedriver dir from PATH env.

So i am sure the problem is related to PATH im my circumstance. After some search, I found that https://www.npmjs.com/package/chromedriver#running-with-selenium-webdriver.
When require('chromedriver'), it will do https://github.com/giggio/node-chromedriver/blob/master/lib/chromedriver.js#L2. So PATH problem solved.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 54.795% when pulling 4c3dd60 on xjchengo:fix-chromedriver into 1c8fb36 on Chatie:master.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments/document to descript this magic line.

Thanks!

@@ -81,6 +81,8 @@ export class BrowserDriver {
}
*/

require('chromedriver')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add comments above this line to memo the details?

Becasue it looks wired if without any description.

Anyway, good catch and nice patch. Thank you!

@xjchengo
Copy link
Contributor Author

Comments have been added. But the test failed. I will try to figure it out later.

@coveralls
Copy link

coveralls commented Apr 19, 2017

Coverage Status

Coverage decreased (-0.08%) to 54.701% when pulling 8072783 on xjchengo:fix-chromedriver into 1c8fb36 on Chatie:master.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@huan
Copy link
Member

huan commented Apr 19, 2017

Please let me know when you are ready.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 54.752% when pulling 250df5d on xjchengo:fix-chromedriver into 1c8fb36 on Chatie:master.

@xjchengo
Copy link
Contributor Author

wechaty installs ChromeDriver using apk add chromedriver instead of npm install chromedriver in Docker.
So I don't require chromedriver package in Docker.
However, this time all failed tests threw:

✖ Exited because no new tests completed within the last 180000ms of inactivity

I don't know why they were timeout.

@huan
Copy link
Member

huan commented Apr 19, 2017

  1. The reason that we did not use npm install chromedriver is because npm chromedriver does not support alpine Linux.

    I had submitted an issue on repository of chromedriver: Not support alpine linux giggio/node-chromedriver#70

  2. CI failed because there might have a bug in our code which will cause lost control of our code.

    We have issue [ci] no new tests completed within the last 180000ms of inactivity #175 for monitoring this.

  3. Your PR looks good: it passed 4 CI unit tests:

    • 1 on Appveyor: node@windows
    • 2 on Travis CI: node v6@linux & v6@mac. (failed 2: node v7@linux & v7@mac)
    • 1 on CircleCI: node v7@docker. Passed after the second run.

So don't worry about the failed CI.

Before the PR can be merged, we need at least 3 approvements from @Chatie/contributor. I had already approved, so you need 2 more. After that, we can do merge. :)

Thank you very much!

Copy link
Contributor

@Gcaufy Gcaufy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good for me.

@huan
Copy link
Member

huan commented Apr 24, 2017

@Chatie/contributor anyone who still using windows could check and approve this PR?

@huan huan merged commit 95d35f1 into wechaty:master Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants