首页 > 解决方案 > 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")
  1. 执行时,我面临类型错误。我无法打开 Firefox 和 chrome 驱动程序。
  2. 我已经安装了 chrome 和 gecko 驱动程序。

标签: python-3.xselenium-webdriverfirefoxwebdrivergeckodriver

解决方案


我的脚本旁边有我的“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")

推荐阅读