尝试用selenium自动连接校园网

尝试用selenium自动连接校园网
代码如下(属于是刚出门就被绊倒了)

from selenium import webdriver
from selenium.webdriver.common.by import By
import time


browser = webdriver.Edge()
browser.get('http://172.31.250.142/a70.htm')
time.sleep(3)
username = browser.find_element(By.XPATH,'//*[@id="edit_body"]/div[3]/div[4]/form/input[2]')

报错如下


Traceback (most recent call last):
  File "D:\PyProject\LinkInternet.py", line 10, in <module>
    username = browser.find_element(By.XPATH,'//*[@id="edit_body"]/div[3]/div[4]/form/input[2]')
  File "D:\PyProject\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "D:\PyProject\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "D:\PyProject\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.callFunctionOn threw exception: TypeError: JSON.stringify is not a function
    at buildError (<anonymous>:323:18)
  (Session info: MicrosoftEdge=114.0.1823.67)
Stacktrace:
Backtrace:
    GetHandleVerifier [0x00007FF7DC42AA52+64226]
    Microsoft::Applications::Events::EventProperty::~EventProperty [0x00007FF7DC3BBC12+765378]
    (No symbol) [0x00007FF7DC17CC4C]
    (No symbol) [0x00007FF7DC181B17]
    (No symbol) [0x00007FF7DC183A54]
    (No symbol) [0x00007FF7DC183B40]
    (No symbol) [0x00007FF7DC1C0776]
    (No symbol) [0x00007FF7DC1C0D6A]
    (No symbol) [0x00007FF7DC1FAC17]
    (No symbol) [0x00007FF7DC1DF03F]
    (No symbol) [0x00007FF7DC1B4BB1]
    (No symbol) [0x00007FF7DC1F7FC1]
    (No symbol) [0x00007FF7DC1DEDD3]
    (No symbol) [0x00007FF7DC1B3BEC]
    (No symbol) [0x00007FF7DC1B2DD6]
    (No symbol) [0x00007FF7DC1B4364]
    Microsoft::Applications::Events::ILogManager::DispatchEventBroadcast [0x00007FF7DC608359+1319033]
    (No symbol) [0x00007FF7DC22D298]
    Microsoft::Applications::Events::EventProperty::~EventProperty [0x00007FF7DC309161+33553]
    Microsoft::Applications::Events::EventProperty::~EventProperty [0x00007FF7DC30159F+1871]
    Microsoft::Applications::Events::ILogManager::DispatchEventBroadcast [0x00007FF7DC606F73+1313939]
    Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF7DC3C4248+20232]
    Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF7DC3C0864+5412]
    Microsoft::Applications::Events::ILogConfiguration::operator* [0x00007FF7DC3C095C+5660]
    Microsoft::Applications::Events::EventProperty::~EventProperty [0x00007FF7DC3B4611+735169]
    BaseThreadInitThunk [0x00007FFB67EB7614+20]
    RtlUserThreadStart [0x00007FFB689026A1+33]

补充:换个网址比如某度,然后定位、输入,是不会这样报错的

第九行有问题,没有定位到