zoukankan      html  css  js  c++  java
  • 'phantomjs.exe' executable needs to be in PATH. (selenium PhantomJS python)

    今天selenium PhantomJS python用了下,发现报错,提示我:'phantomjs.exe' executable needs to be in PATH.

    from selenium import webdriver# Open PhantomJS
    driver = webdriver.PhantomJS(executable_path='C:phantomjs-2.1.1-windowsinphantomjs.exe')
    这样运行报错,我百度了下,发现解决方式,在完整路径前面加了一个r 就行了
    driver = webdriver.PhantomJS(executable_path=r'C:phantomjs-2.1.1-windowsinphantomjs.exe')
    # coding=utf-8
    from selenium import webdriver
    # Open PhantomJS
    driver = webdriver.PhantomJS(executable_path=r'C:phantomjs-2.1.1-windowsinphantomjs.exe')
    driver.get("http://www.qq.com")
    title = driver.title
    driver.save_screenshot('qq.png')
    print title #腾讯首页

  • 相关阅读:
    会议10
    会议09
    回忆8
    会议07
    团队报告三
    深圳展会问题关注
    移动电源频率设置
    安卓java设置字体颜色
    安卓取消默认的标题栏方法
    安卓,按钮清晰的事件注册写法
  • 原文地址:https://www.cnblogs.com/lxs1314/p/8377582.html
Copyright © 2011-2022 走看看