【问题标题】:import selenium to python将硒导入python
【发布时间】:2014-11-16 20:19:34
【问题描述】:

我使用 pip 将 selenium 安装到我的 mac。当我尝试运行此文件时,终端中包含此代码:

from selenium import webdrive
browser = webdrive.Firefox
browser.get("http://localhost:8000")
assert "Django" in browser.title 

上面写着:

Traceback (most recent call last):
  File "functional_test.py", line 1, in <module>
  from selenium import webdrive
  ImportError: cannot import name webdrive

我认为 python 没有导入 selenium... 任何想法

【问题讨论】:

    标签: python django selenium


    【解决方案1】:

    你需要导入webdriver:

    from selenium import webdriver
    

    【讨论】:

    • 我想通了...文本编辑器卡住了,当然应该是 webdriver 而不是 webdrive ...非常感谢
    猜你喜欢
    • 1970-01-01
    • 2021-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-18
    • 2020-08-10
    • 2016-04-23
    • 2020-12-31
    相关资源
    最近更新 更多