我将Selenium与chromewebdriver一起使用,它们具有以下配置:
let driverOptions = new ChromeOptions()
driverOptions.addArguments('--disable-popup-blocking')
driverOptions.addArguments('--disable-web-security')
我不时收到以下错误
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:53952
at ClientRequest.<anonymous> (C:\snapshot\overlight-headless\node_modules\selenium-webdriver\http\index.js:258:15)
at ClientRequest.emit (events.js:196:13)
at Socket.socketErrorListener (_http_client.js:409:9)
at Socket.emit (events.js:196:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:84:9)
我确定它与警报框有关。我想忽略所有警报(因此,在我的情况下,switchTo.alert不是解决方案)。我可以设置chromedriver默认情况下关闭或接受所有警报吗?我在文档中找不到信息,但是我知道Firefox存在这样的taht选项。