GVKun编程网logo

NotADirectoryError:[Errno 20]不是目录:使用Python3的GeckoDrriver Firefox和Selenium的'/home / ghost / automation / pwd / geckodriver'

9

本文将分享NotADirectoryError:[Errno20]不是目录:使用Python3的GeckoDrriverFirefox和Selenium的'/home/ghost/automation

本文将分享NotADirectoryError:[Errno 20]不是目录:使用Python3的GeckoDrriver Firefox和Selenium的'/home / ghost / automation / pwd / geckodriver'的详细内容,此外,我们还将为大家带来关于Chormedrive以及Firefox浏览器驱动Geckodriver下载安装步骤、chromedriver、firefox-geckodriver、iedriver 下载链接、Firefox Geckodriver 问题 - INTERNALERROR>....WebDriverException:消息:TypeError:browsingContext.currentWindowGlobal 为空、from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'的相关知识,希望对你有所帮助。

本文目录一览:

NotADirectoryError:[Errno 20]不是目录:使用Python3的GeckoDrriver Firefox和Selenium的'/home / ghost / automation / pwd / geckodriver'

NotADirectoryError:[Errno 20]不是目录:使用Python3的GeckoDrriver Firefox和Selenium的'/home / ghost / automation / pwd / geckodriver'

我正在使用pycharm和我的pythn

版本3.6.7点9.0.1

和selenium版本selenium-3.141.0 urllib3-1.24.1

我使用此命令安装selenium

pip3 install selenium

然后我这样编码

from selenium import webdriverdriver = webdriver.Firefox("/home/ghost/automation/pwd/geckodriver")driver.set_page_load_timeout(30)driver.get("https://www.google.com/")driver.maximize_window()driver.implicitly_wait(120)driver.get_screenshot_as_file("google.png")driver.quit()

当我运行这个时,我得到这个错误

/home/ghost/PycharmProjects/try/venv/bin/python /home/ghost/PycharmProjects/try/open/testcas1.pyTraceback (most recent call last):  File "/home/ghost/PycharmProjects/try/open/testcas1.py", line 3, in <module>    driver = webdriver.Firefox("/home/ghost/automation/pwd/geckodriver")  File "/home/ghost/PycharmProjects/try/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 151, in __init__    firefox_profile = FirefoxProfile(firefox_profile)  File "/home/ghost/PycharmProjects/try/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_profile.py", line 80, in __init__    ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))  File "/usr/lib/python3.6/shutil.py", line 309, in copytree    names = os.listdir(src)NotADirectoryError: [Errno 20] Not a directory: ''/home/ghost/automation/pwd/geckodriver''Process finished with exit code 1

在这一行中 driver = webdriver.Firefox("/home/ghost/automation/pwd/geckodriver")
geckodriver 我的 geckodriver版本的 正确路径 是0.23.0

答案1

小编典典

虽然有工作 GeckoDriver火狐 ,你需要使用 密钥 executable_path 设置到 绝对路径
中的 GeckoDriver 单引号,即''...''用斜杠即/作为 路径分隔符 ,如下所示:

driver = webdriver.Firefox(executable_path=''/home/ghost/automation/pwd/geckodriver'')

Chormedrive以及Firefox浏览器驱动Geckodriver下载安装步骤

Chormedrive以及Firefox浏览器驱动Geckodriver下载安装步骤

ChormeDrive下载
  打开百度搜索Chromedriver官网下载,点击进入这个页面,链接为:http://npm.taobao.org/mirrors/chromedriver/2.41/   如图所示:

选择符合自己电脑操作系统的版本,点击进行下载,完成后解压缩

火狐浏览器驱动geckoDriver下载
  Firefox驱动下载地址:https://github.com/mozilla/geckodriver/releases  进入这个页面,如图所示:

选择自己电脑操作系统对应的版本,点击进行下载,完成后解压缩

安装驱动
  将下载下来的GeckoDriver.exe和Chromedriver.exe放入python安装路径下的Scripts文件夹内(相当于加入环境变量),退出重启Pycharm,安装完成。

 

chromedriver、firefox-geckodriver、iedriver 下载链接

chromedriver、firefox-geckodriver、iedriver 下载链接

来源:https://www.cnblogs.com/givemelove/p/8482361.html

1. 所有版本 chrome 下载

是不是很难找到老版本的 chrome?博主收集了几个下载 chrome 老版本的网站,其中哪个下载的是原版的就不得而知了。

http://www.slimjet.com/chrome/google-chrome-old-version.php

http://google_chrome.en.downloadastro.com/old_versions/

http://filehippo.com/zh/download_google_chrome/

http://www.chromedownloads.net/

下面这个网址大多是 Mac 的多些,Windows 下的很缺,但是有好多其他的软件下载,可以去看看:uptodown

2. 所有版本 firefox 下载

火狐相对比较容易找,这里也贴出来其 ftp 链接:

http://ftp.mozilla.org/pub/firefox/releases/

geckodriver 下载地址

https://github.com/mozilla/geckodriver/releases

至于火狐的版本与 selenium 的对应关系,确实没有这方面合适的资料,不过建议 selenium 2.53 以及以下的朋友,用 47 以下的火狐。

3. 所有版本 chromedriver 下载

chromedriver 的版本也不容易找:

http://chromedriver.storage.googleapis.com/index.html

其中各版本下的 notes.txt 中说明了该版本以及以前一些版本支持的 chrome 浏览器版本,不过,老司机早就给你整理了一份一目了然的表格:

selenium 之 chromedriver 与 chrome 版本映射表

这样,该下载哪个版本的 chrome 与 chromedriver 是不是就很清楚了。

4. 所有版本 selenium 以及 IEDriverServer 下载

最后,当然还有 selenium 和 IEDriverServer,Python 版的 selenium 直接 pip 就可以了,下面的链接里主要是 Java 版的和.NET 版的:

http://selenium-release.storage.googleapis.com/index.html

 

 

 

安装三大浏览器驱动 driver
     1.chromedriver 下载地址:https://code.google.com/p/chromedriver/downloads/list
     2.Firefox 的驱动 geckodriver 下载地址:https://github.com/mozilla/geckodriver/releases/
     3.IE 的驱动 IEdriver 下载地址:http://www.nuget.org/packages/Selenium.WebDriver.IEDriver/

原文:https://blog.csdn.net/azsx02/article/details/68947429

Firefox Geckodriver 问题 - INTERNALERROR>....WebDriverException:消息:TypeError:browsingContext.currentWindowGlobal 为空

Firefox Geckodriver 问题 - INTERNALERROR>....WebDriverException:消息:TypeError:browsingContext.currentWindowGlobal 为空

如何解决Firefox Geckodriver 问题 - INTERNALERROR>....WebDriverException:消息:TypeError:browsingContext.currentWindowGlobal 为空?

我的套件适用于 Chrome 和 Edge,但不适用于 Firefox。它开始并突然结束。

尝试了不同版本的 geckodriver (32/64),更新的 firefox 浏览器 - 没有运气

日志: Image with logs

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'

from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'

如何解决from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named ''selenium''?

这是我的问题:当我运行 thos 脚本时,我的 cmd 向我返回一条错误消息,该消息与我的模块的导入有关。

导入脚本:

import logging
import os
import time
from lib2to3.pgen2 import driver

from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import webdriverwait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.firefox.webdriver import FirefoxProfile
from selenium.webdriver import ActionChains,DesiredCapabilities


# ================================ LOGGER ====================================
import pathlib
import platform
import shutil
import psutil

第一个 cmd 的消息是:

from selenium.webdriver.firefox.options import Options
ModuleNotFoundError: No module named ''selenium''

起初我认为这是我在安装 selenium 后安装的 FireFox 导航器的错误,但最后命令提示符给了我与 Chrome 相同的消息 :O ! 我检查了我的 Pyhton 的版本:“Python 3.9.2”。然后卸载selenium(已经安装了):

pip uninstall selenium
Found existing installation: selenium 3.141.0
Uninstalling selenium-3.141.0:
  Would remove:
    c:\users\w10cp\desktop\stage\venv\lib\site-packages\selenium-3.141.0.dist-info\*
    c:\users\w10cp\desktop\stage\venv\lib\site-packages\selenium\*
Proceed (y/n)? y
  Successfully uninstalled selenium-3.141.0

然后我再次安装它:

pip install selenium
Collecting selenium
  Using cached selenium-3.141.0-py2.py3-none-any.whl (904 kB)
Requirement already satisfied: urllib3 in c:\users\w10cp\desktop\stage\venv\lib\site-packages (from selenium) (1.26.4)
Installing collected packages: selenium
Successfully installed selenium-3.141.0

但那是一样的:

from selenium.webdriver.firefox.options import Options
ModuleNotFoundError: No module named ''selenium''

所以我跑了

C:\Users\w10cp\Desktop\Stage>python
Python 3.9.2 (tags/v3.9.2:1a79785,Feb 19 2021,13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
Type "help","copyright","credits" or "license" for more information.
>>> import selenium

但没有任何变化

File "<stdin>",line 1,in <module>
ModuleNotFoundError: No module named ''selenium''

所以我继续使用 Stack OverFlow 寻找答案。 我成功卸载了 selenium 然后执行:

python -m pip install -U selenium

所以我再次运行我的脚本,结果如​​下:

from webdriver_manager.chrome import ChromeDriverManager
ModuleNotFoundError: No module named ''webdriver_manager''

所以我做了

pip install webdriver_manager

它已成功安装,但它返回相同的错误消息。 如果有人知道我必须做什么,请帮助我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

关于NotADirectoryError:[Errno 20]不是目录:使用Python3的GeckoDrriver Firefox和Selenium的'/home / ghost / automation / pwd / geckodriver'的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于Chormedrive以及Firefox浏览器驱动Geckodriver下载安装步骤、chromedriver、firefox-geckodriver、iedriver 下载链接、Firefox Geckodriver 问题 - INTERNALERROR>....WebDriverException:消息:TypeError:browsingContext.currentWindowGlobal 为空、from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'的相关知识,请在本站寻找。

本文标签: