小编Nik*_*e08的帖子

如何使用 puppeteer 最大化浏览器窗口?

我正在尝试使用puppeteer. 我尝试了下面的代码,但浏览器没有最大化到完整模式。我也没有在 puppeteer 库中找到任何可用的函数来最大化窗口。

(async () => {
  const browser = await puppeteer.launch({headless: false , slowMo: 100, rgs: ['--start-fullscreen', '--window-size=1920,1080'], executablePath: 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe' });
  const page = await browser.newPage();

  await page.setViewport({ width: 1920, height: 1080 });
Run Code Online (Sandbox Code Playgroud)

示例图像

node.js puppeteer

9
推荐指数
3
解决办法
8041
查看次数

如何比较 Cypress 中的数组?

我想将数组中存在的数据与在 cypress 中使用 .each 从类中检索到的数据进行比较?

使用下面的代码,我尝试使用下面的代码迭代 FileType 数组。

const Filetype = ['Access', 'Excel', 'Text/CSV','PDF','JSON','dsdsd'];
const te = cy.wrap($bodyFind).find('.data-sourcename').should('have.length',6).each(($li) => { cy.log($li.text()); });

te.each(($text)=> {
cy.log("Te" + $text); 
//prints ['Access','Excel','Text/CSV','PDF','JSON','XML'];
});

// Converted FileType Array to Cypress object using cy.wrap command.
const cywrap = cy.wrap(Filetype);
      te.each((e1)=>cywrap.each((e2)=> {
      if(e1 == e2) {
         expect(e1).equals(e2);
       }
     }));
Run Code Online (Sandbox Code Playgroud)

但是e1和e2的值是一样的。期望应该失败,“dsdsd”等于“XML”,而它通过“dsdsd”等于“dsdsd”

cypress

8
推荐指数
1
解决办法
9623
查看次数

标签 统计

cypress ×1

node.js ×1

puppeteer ×1