python-3.x - TypeError:“模块”对象在 pycharm 中无法通过 Python 使用 Selenium 调用
问题描述
from selenium import webdriver
driver=webdriver.firefox("D:\Pycharm_automation\geckodriver-v0.27.0-win64\geckodriver.exe")
driver.get("google.com")
- 执行时,我面临类型错误。我无法打开 Firefox 和 chrome 驱动程序。
- 我已经安装了 chrome 和 gecko 驱动程序。
解决方案
我的脚本旁边有我的“geckodriver.exe”。
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
import time
opts = Options()
browser = Firefox(options=opts)
browser.get("www.google.de")
推荐阅读
- reactjs - onPress 不适用于 Animatable 组件
- python - Django模型继承:从父查询集访问子对象
- ios - 为什么在 NSFetchRequest 上设置 resultType 属性
- sql-server - 删除表后重新运行脚手架
- input - 检查输入单选时显示/隐藏
- c# - 使用 API 从 Azure blob 下载
- c# - 在本地开发中使用不同的连接字符串
- scala - How to sort an Iterable without creating intermediate Seq?
- java - 尝试在 Java 中对 Google pubsub 执行同步拉取时出错
- bash - 在 bash 脚本内的自定义 shell 实例中运行命令