English 中文(简体)
Cypress - Hidden Elements
  • 时间:2024-03-24 10:07:48

Cypress - Hidden Elements

Previous Page Next Page  

风暴能够处理隐藏的元素。 有时,子宫只被 h在主菜.上。 这些子动物最初被隐藏在Cascading上型谢物(CSS)上:无。

在处理隐蔽元素时,Cypress利用 j法显示的帮助。 必须在Cypress指挥部的帮助下援引。

For example, on hovering over the Sign in menu, the Sign in button gets displayed, as shown below −

Sign in

On在把 mo子从 Sign子中搬出时, Sign子的签字被隐藏起来,如下所示。

Sign in Menu

Implementation

采用“ j show”法的隐藏元素如下:


describe( Tutorialspoint Test , function () {
   // test case
   it( Scenario 1 , function (){
      // launch URL
      cy.visit("https://www.amazon.com/");
      // show hidden element with invoke
      cy.get( #nav-flyout-ya-signin ).invoke( show );
      //cpck hidden element
      cy.contains( Sign ).cpck();
   });
});

产出如下:

jQuery show

describe( Tutorialspoint Test , function () {
   // test case
   it( Scenario 1 , function (){
      // launch URL
      cy.visit("https://www.amazon.com/");
      // show hidden element with invoke
      cy.get( #nav-flyout-ya-signin ).invoke( show );
      //cpck hidden element
      cy.contains( Sign ).cpck();
   });
});

Execution Results

产出如下:

Hidden Elements with jQuery

执行记录显示由icon代表的隐藏要素是步骤的权利。

热带风暴具有另一种处理隐蔽元素的技术。

例如,为了点击一个隐蔽的元素,我们可以点击Cypress指挥,并通过选项{force:真实}作为参数,点击(力量:真实})。

这改变了隐藏元素的隐蔽特征,我们可以点击。

Implementation with cpck

下面是用点击在Cypress实施。


describe( Tutorialspoint Test , function () {
   // test case
   it( Scenario 1 , function (){
      // launch URL
      cy.visit("https://www.amazon.com/");
      //cpck hidden element
      cy.contains( Sign ).cpck({force:true});
   });
});

产出如下:

Implementation with Cpck

处决记录显示被点击的隐性元素(Sign in),我们被浏览到下页。

Advertisements