【问题标题】:python splinter webdriver can't startpython splinter webdriver无法启动
【发布时间】:2017-12-04 17:52:00
【问题描述】:

我写了一个简单的文件splinter_test.py

    from splinter import Browser

    print("here")
    br = Browser()

当我运行代码时,它会打印出来

在 0.000 秒内运行 0 次测试

好的

我使用 IDLE 运行,但它在命令行中打印相同。 它甚至没有到达我的print("here") 声明。 此外,Browser 导入不起作用,即我不能使用 b = Browser()

【问题讨论】:

  • 我从来没有从 IDLE 得到一个 webdriver 工作有一些不兼容。从命令行运行您的脚本。至于打印,你可以尝试刷新缓冲区。

标签: python selenium selenium-webdriver splinter


【解决方案1】:

您的电脑中似乎没有安装“splinter”模块。 试试这个,去运行并启动命令提示符,在里面放下面一行

python -m pip install splinter

它会安装它,我试过你写的,它在路径中需要gecodriver所以去这个链接“https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-win64.zip” 解压并把这个文件放到path.Done

【讨论】:

  • 谢谢。我确实有碎片,当我写 import splinter 时,我看到了这条消息,并且没有导入错误。我实际上也用 phantomjs 进行了尝试(我传递了参数和可执行路径),并且显示了相同的消息,那么 gecko 驱动程序将如何工作?
  • 需要 Geckodriver 才能在您的 PC 中打开 Firefox 浏览器。因此,每当调用 Browser() 时,它都会调用 geckodriver.exe 并打开 firefox 浏览器。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-18
  • 2015-02-28
  • 2017-02-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多