赛普拉斯(Cypress):无法使用I框架打开页面

时间:2020-11-10 16:58:51

标签: iframe cypress

我正在尝试打开带有I型框架的页面:

我已经完成的其他步骤:

1. When I enable "chromeWebSecurity": true, I get the error: Cypress detected a cross-origin error happened on page load: > Blocked a frame with origin  
2. When I disable "chromeWebSecurity": false, I get the error:  Timed out retrying: expected 'chrome-error://chromewebdata/' and it doesn't redirect to the expected page 
3. Updated package.json file: 
      `"scripts": {
          "download-extension": "ced gleekbfjekiniecknbkamfmkohkpodhe extensions/ignore-x-frame-headers" 
        }
        devDependencies": {
           "chrome-ext-downloader": "^1.0.4",
           "cypress": "^5.3.0" 
   }`

4. Updated index.js file:
 `module.exports = (on, config) => {
        on('before:browser:launch', (browser = {}, args) => {
            console.log(config, browser, args);
            if (browser.name === 'chrome') {
                const ignoreXFrameHeadersExtension = path.join(__dirname, '../extensions/ignore-x-frame-headers');
               args.push(args.push(`--load-extension=${ignoreXFrameHeadersExtension}`));
               args.push("--disable-features=CrossSiteDocumentBlockingIfIsolating,CrossSiteDocumentBlockingAlways,IsolateOrigins,site-per-process");}
               return args;
            });
     };`

有什么想法可以解决此问题?

代码:

       it('check X login', () => {
         cy.visit(baseUrl);
         cy.title().should('eq', 'Inloggen');
         cy.get(loginButton).click();
         cy.url().should('contain', expectedURL); // the step where the errors appear
      })
  });```

0 个答案:

没有答案