English 中文(简体)
Cypress - Dropdown
  • 时间:2024-03-24 10:11:18

Cypress - Dropdown

Previous Page Next Page  

指挥选择用来进行静态下降。 在《html法典》中,降幅有选择的标签,而减小部分则由选择标签代表。

Dropdown Cypress Commands

与气球有关的降水指挥如下:

    用于选择选项>的指挥系统 如下:


cy.get( select ).select( Cypress )

    选择Tutorialspoint和Java的指挥如下:


cy.get( select ).select([ Tutorialspoint ,  JavaScript ])

    可选择降级办法的价值的指挥,以及选择(修改缺省特性) 如下:


cy.get( select ).select( option1 , options )

    选择的多面值和选择的指挥 如下:


cy.get( select ).select([ option1 ,  option2 ], options)

Options for dropdown in Cypress

热带风暴降幅的备选办法如下:

    log - Default Value - real- 这被用于处理/抵消ole木。

    timeout – Default value – defaultCommandTimeout(4000)− This is used to provide the maximum wait time for the selection prior to throwing an error.

    force - Default Value - mis- 这被用于执行一项行动。

可在Cypress的选定指挥中应用污染物。

让我们尝试从《html法典》中价值为99的下降中选择India

Dropdown Cypress Commands

Implementation

下面对印度热带风暴中选择印度选项的下级指挥的执行情况作出解释。


// test suite
describe( Tutorialspoint , function () {
   // it function to identify test
   it( Scenario 1 , function (){
      // test step to launch a URL
      cy.visit("https://register.rediff.com/register/register.php")
      //select option India with value then verify with assertion
      cy.get( select[id="country"] ).select( 99 ).should( have.value ,  99 )
   })
})

产出如下:

Dropdown Commands

The output shows that the Country dropdown selects the option India (in the html code, this option is identified with the value as 99).

Advertisements