Errors encountered when building Splinter+python environment

Source: Internet
Author: User

Because do not want to use URLLIB2, have not used splinter, today want to try, after all, the latter support more user-friendly features/automation.

1, install splinter

The installation process is simple and the PIP is installed to execute:

$ [sudo] pip install splinter
or go to Splinter's GitHub page, download the source code (link address:https://github.com/cobrateam/splinter), and then execute:
$ git clone git://github.com/cobrateam/splinter.git$ CD splinter$ [sudo] python setup.py install

The dependent libraries that are required during installation are automatically downloaded without fear.

2, install Chromedriver

Because I need chrome to support the page test, I need to install chromedriver. The installation process is simple (actually no need to install), note the next version, some of the lower version is not supported by the high version of Chrome. Image link: http://npm.taobao.org/mirrors/chromedriver.

I just threw chromedriver.exe in the c/windows/system32/folder, so I didn't need to configure the environment variable.

Then I wrote the first line "Hello World", the code is as follows:

#-*-Coding:utf-8-*-import sysfrom splinter.browser import browserreload (SYS) sys.setdefaultencoding (' UTF8 ') encoding = Lambda X:x.encode (' gbk ') browser = browser (driver_name= "Chrome") browser.visit ("https://www.baidu.com") print Encoding ("test page:" + browser.title) browser.quit ()

Run for a moment and quote the following information:

Error message: "' chromedriver ' executable needs to being available in the path"
 Did I forget to add the Chromedriver.exe to path? But I thought it was wrong. Because I put chromedriver.exe directly under the c/windows/system32/folder, it is not necessary to add the path in path. For the sake of prudence, I added "c/windows/system32;" (stupid enough) in path. But a running error is still.

I simply gave up path at the back, I used absolute path reference, the error is still. Restart? It's still not working. On the StackOverflow checked, there are many people who have this problem, but most of the answers are suggested using absolute paths, which does not solve my problem. Just as I gave up splinter, loaded selenium , I suddenly thought, put Chromedriver.exe under script to try? Sure enough, I put the chromedriver.exe and my test. PY on the same path, and it's no problem to run them.

Remember, lest you forget.

Errors encountered when building Splinter+python environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.