简体   繁体   中英

Getting below error whenever I try to run Cypress Suite

Error: Cannot find module 'cypress-xpath' from 'D:\Automation Code\Cypress\cypress-ui-automation\cypress\support' at D:\Automation Code\Cypress\cypress-ui-automation\node_modules\browser-resolve\node_modules\resolve\lib\async.js:46:17 at process (D:\Automation Code\Cypress\cypress-ui-automation\node_modules\browser-resolve\node_modules\resolve\lib\async.js:173:43) at ondir (D:\Automation Code\Cypress\cypress-ui-automation\node_modules\browser-resolve\node_modules\resolve\lib\async.js:188:17)

It looks like you have missed the install of cypress-xpath .

If you are installing with npm:

npm install -D cypress-xpath

or if you are installing with yarn:

yarn add cypress-xpath --dev

You clearly already have the the require statement in \cypress\support since that is the first path in the error stack.

Assuming that the cypress-xpath plugin is already installed, Under cypress/support/e2e.js you have to add this:

require('cypress-xpath');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM