我正在尝试在 python 中使用 selenium 构建一个刮刀。Selenium Webdriver 打开窗口并尝试加载页面但突然停止加载。我可以在本地 Chrome 浏览器中访问相同的链接。
以下是我从网络驱动程序获得的错误日志:
{'level': 'SEVERE', 'message': 'https://shop.coles.com.au/a/a-nsw-metro-rouse-hill/everything/browse/baby/nappies-changing?pageNumber=1 - Failed to load resource: the server responded with a status of 429 (Too Many Requests)', 'source': 'network', 'timestamp': 1556997743637}
{'level': 'SEVERE', 'message': 'about:blank - Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME', 'source': 'network', 'timestamp': 1556997745338}
{'level': 'SEVERE', 'message': 'https://shop.coles.com.au/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint - Failed to load resource: the server responded with a status of 404 (Not Found)', 'source': 'network', 'timestamp': 1556997748339}
Run Code Online (Sandbox Code Playgroud)
我的脚本:
from selenium import webdriver
import os
path = …Run Code Online (Sandbox Code Playgroud) selenium google-chrome web-scraping python-3.x selenium-chromedriver
我正在尝试使用python无头Chrome Web驱动程序下载文件。我的代码运行缓慢。没有输出(下载)文件。我没有任何错误。任何帮助,将不胜感激。这是我的代码:
# Getting All User Credintials
for x in range(2,st.max_row + 1):
Users.append([st.cell(x, 1).value,st.cell(x, 2).value, st.cell(x, 3).value])
# Looping through Users
for item in Users:
try:
chrome_options = Options()
chrome_options.add_argument("--headless")
prefs = {"download.default_directory": os.getcwd()}
chrome_options.add_experimental_option("prefs", prefs)
chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get(Url)
chrome.find_element_by_id("formId:codEmpresa").send_keys(item[0]) # Enterinng login Credintials
chrome.find_element_by_id("formId:codUsuario").send_keys(item[1])
chrome.find_element_by_id("formId:senha").send_keys(item[2])
chrome.find_element_by_link_text("Entrar").click() # Clicking Login button
chrome.get("https://www3.honda.com.br/newihs/AbrirPag?Opcao=1998")
chrome.find_element_by_name("W0002vWDINI").send_keys(DateFrom) # Entering DateForm
chrome.find_element_by_name("W0002vWDFIM").send_keys(DateTo) # Entering DateTo
chrome.find_element_by_name("W0002BT_CONFIRMAR").click() # Clicking Confirm button
wait = WebDriverWait(chrome, 10)
element = wait.until(EC.element_to_be_clickable((By.NAME, 'W0002BT_INFORMAR2')))
chrome.find_element_by_name("W0002BT_INFORMAR2").click() # Clicking Download button
Run Code Online (Sandbox Code Playgroud) download python-3.x selenium-webdriver google-chrome-headless