赛普拉斯.IO选择下拉 [英] Cypress.IO Select Drop Down

查看:65
本文介绍了赛普拉斯.IO选择下拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对赛普拉斯很陌生,我想编写一个简单的测试,以在页面首次加载时将选择框(下拉列表)设置为特定状态.我不想将其设置为任何内容,网站上的说明清楚显示了该内容.我只想确保页面首次加载时将选择框设置为应有的状态.我确信这很容易做到,我现在正在查看文档.到目前为止,我有:

I am very new to Cypress and I want to write a simple test that a select box (drop down) is set to a certain state when the page first loads. I don't want to set it to anything, which the instructions on the website clearly show. I just want to make sure when the page first loads the select box is set to what it should be. I am sure this is easy to do and I am looking over the documentation now. So far I have:

cy.get('#sinkerTypeList)

然后我不知道如何确保其具有文本所有接收器类型"

and then I can't figure out how to make sure it has the text "All Sinkers Types"

推荐答案

所以不确定这是否是最好的方法,但是我知道这是可行的

So not sure if this is the best way to do it, but I got this to work

it('the selected option should be All Sinker Types', function () {
        cy.get('#sinkerTypeList')
            .find(':selected').contains('All Sinker Types')
    })

这篇关于赛普拉斯.IO选择下拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆