-1
Я пытаюсь найти способ сделать снимок экрана (который у меня есть метод, созданный для), когда есть «ElementNotFoundError», без необходимости определять его везде в сценарии (например, , каждый раз, когда я ищу элемент через ".then (driver.findElement (By.id()). click()), мне не обязательно указывать снимок экрана в« catch ».Selenium и Node.JS ElementNotFoundError или NoSuchElementError
Вот типичная ошибка ElementNotFound:
/Users/nhyland/Documents/www/Selenium/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41
goog.global.setTimeout(function() { throw exception; }, 0);
^
NoSuchElementError: Unable to locate element: {"method":"class name","selector":"loginID"}
at new bot.Error (/Users/nhyland/Documents/www/Selenium/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
at Object.bot.response.checkResponse (/Users/nhyland/Documents/www/Selenium/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
at /Users/nhyland/Documents/www/Selenium/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:379:20
at promise.Promise.goog.defineClass.invokeCallback_ (/Users/nhyland/Documents/www/Selenium/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)