首页 > 解决方案 > 几个月来一直没有错误地运行它 - 现在得到)]“未捕获(承诺)TypeError:无法获取”

问题描述

我已经运行这部分代码几个月没有错误,现在得到:“Uncaught (in promise) TypeError: Failed to fetch” 即使我以前的版本现在也失败了。

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.common.exceptions import *
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

vars = {}
from tkinter import *
import datetime
import winsound
import re


def makeOneReservation():
    global driver

   driver=webdriver.Edge(executable_path='C:\Python27amd64\msedgedriver')
   driver.get("https://www.canyonoakscc.com/")

makeOneReservation()

错误:

DevTools listening on ws://127.0.0.1:53979/devtools/browser/dcd9054e-10ae-4df0-87f5-2ab9b0fb892f
Press any key to continue . . . [19532:25280:1017/110133.543:ERROR:CONSOLE(0)] "Access to fetch at 
'https://www.bing.com/rp/rms_pr.png' from origin 'https://ntp.msn.com' has been blocked by CORS 
policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque 
response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS 
disabled.", source: https://ntp.msn.com/edge/ntp?locale=en-US&fre=1&dsp=1&sp=Bing&prerender=1 (0)
[19532:25280:1017/110133.549:ERROR:CONSOLE(1)] "UnhandledError:Error: TypeError: Failed to fetch
Stack:Error: TypeError: Failed to fetch
    at https://assets.msn.com/bundles/v1/edgeChromium/latest/vendors.32298e43877474399a50.js:1:206118 
[object Object] Sat Oct 17 2020 11:01:33 GMT-0700 (Pacific Daylight Time)", source: 
https://assets.msn.com/bundles/v1/edgeChromium/latest/vendors.32298e43877474399a50.js (1)
[19532:25280:1017/110133.549:ERROR:CONSOLE(0)] "Uncaught (in promise) TypeError: Failed to fetch", 
source: https://ntp.msn.com/edge/ntp?locale=en-US&fre=1&dsp=1&sp=Bing&prerender=1 (0)

该程序确实继续并成功完成,但为什么现在出现此错误?我能做些什么来消除这个错误?尝试了两个推荐的插件,但都没有。

标签: python-3.x

解决方案


推荐阅读