我试图用我的默认用户使用selenium python库打开一个网页,脚本使用默认用户是很重要的,但是如果我的chrome浏览器已经打开,脚本就会崩溃,并给出这个错误:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
我已经
我使用Selenium和Chrome来模拟点击一个下载PDF文件的按钮。一切按预期运行,Chrome显示下载成功,单击Chrome上的文件将打开并充分显示该文件。但是,当我尝试从文件管理器或任何其他应用程序(包括作为超级用户的ls -a )访问该文件时,下载的文件就不在那里。这是Selenium/Chrome故意做的吗?有没有办法绕过这一点?
我在Xubuntu 20.04.2 LTS上运行Python 3.8.5。Selenium的版本是3.141.0,ChromeDriver是90.0.4430.212。
这是我初始化webdriver的方式:
from tempfile import T
当芹菜任务尝试使用Selenium时,我会得到以下错误;
[2020-06-12 23:23:04,228: WARNING/ForkPoolWorker-1] Message: unknown error: Chrome failed to start: exited abnormally.
(chrome not reachable)
(The process started from chrome location /opt/python/run/venv/bin/google-chrome is no longer running, so ChromeDriver is ass
我在python中得到了下面的selenium错误。我已经通过安装了selenium,pip安装了selenium,然后将selenium文件解压缩到C:\Program \Python36 36中。
这是我的剧本:
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
dir = os.path.dirname('C:\chromedriver_win32')
chrome_driver_path = dir + "\chromedriver.e
在尝试使用chrome driver和--user-data-dir和--profile-directory部署--user-data-dir和--profile-directory时,我已经意识到了一些非常奇怪的事情,请参阅下面的内容:
如果您编译了以下代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
opt = Options() #the variabl
我已经创建了一个方法来在WebDriverFactory.py中生成一个Webdriver
#!python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
def generer_chrome_driver():
driver = webdriver.Chrome(service=Service(ChromeDriverManager().insta
每次运行python算法时,我都会在cmd中得到这个错误:
Traceback (most recent call last):
File "newScrape.py", line 1, in <module>
import SScraper as SS
File "build\bdist.win32\egg\SScraper\__init__.py", line 45, in <module>
File "C:\Python27\lib\site-packages\selenium-2.43.0-py2.7.egg\seleni
已经安装了chromedriver,但由于某种原因,在运行此代码时,一直会在我的新计算机上出现此问题,我会收到以下错误消息:
import requests, bs4, sys, webbrowser, random, pyperclip, re, time
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome()
我正在尝试使用selenium和chromedriver从网页中获取页面内容。我在Windows上使用Ubuntu18.04子系统。driver.get方法可以工作,但是获取页面内容不起作用。这是我的代码:
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
import time
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--no-sandbox")
我知道已经有人问过非常类似的问题,但即使经过几个小时的谷歌搜索、研究和比较,我也找不出问题所在。我的最终目标是使用selenium用Python进行一些web抓取,但是现在我甚至不能启动webdriver。这是我到目前为止得到的代码和错误消息:
$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more informati
我想为Instagram.com和Python3创建一个自动登录。我告诉自己,我必须用这个来处理网站:
from selenium import webdriver
但是在所有的教程中,我发现他们在这方面没有任何问题,但是我得到了一个错误消息:
错误消息
我浏览了其他问题,发现也应该解决我的问题,但是和他们提出的代码并没有解决我的问题。
到目前为止,我的完整代码:
from selenium import webdriver
from time import sleep
username = "username"
class InstaBot:
def __i
我得到了一个类似Pycharm的错误:
Traceback (most recent call last):
File "C:/PycharmProjects/DemoPyth/PythonPack1/Prg1.py", line 3, in <module>
driver=webdriver("C:\\Python34\\Lib\\site-packages\\selenium\\webdriver\\chromedriver.exe")
TypeError: 'module' object is not call
当我试图运行我的代码时,我收到了这个错误,让我知道我能做什么。如果需要的话,我会在这里贴出完整的代码。
Traceback (most recent call last):
File "C:\Users\hp\Desktop\FB\GUI.py", line 104, in <module>
main()
File "C:\Users\hp\Desktop\FB\GUI.py", line 65, in main
driver = webdriver.Chrome(options=options)
File "C: