简体   繁体   中英

Cypress doesn't select the desired option from Select element in angular

In my automation testing project I need to select option from a select element. I'm doing this with cypress and it's Angular project

I'm new to cypress and I did exactly what the documentation states

Here's my select with cypress

cy.get("#myElement").select(myOptionValue)

Here's the html

在此处输入图片说明

it didn't work. is there any workaround or any way I can do it. I didn't found any solution online

side note: when I run the test it looks like it selects it and then it returns back to the default one. maybe this is an issue with the angular code?

you are right according to documentation

try this cy.get("#businesActivity").select('Service')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM