如何访问cypress中的url并更改其中一个参数的值,或者仅更改url的值?
我有一个特定的url,通过输入值使用从输入中获取的参数,如何使用url中的cypress更改值如何访问cypress中的url并更改其中一个参数的值,或者仅更改url的值?,cypress,Cypress,我有一个特定的url,通过输入值使用从输入中获取的参数,如何使用url中的cypress更改值 http://localhost:28080/app/form/54fd3434f? -initial url http://localhost:28080/app/form/54fd3434f?text_field=Text&text_field2=Text2 -expected url after type 你可以这样做- cy.url().then(url => {
http://localhost:28080/app/form/54fd3434f? -initial url
http://localhost:28080/app/form/54fd3434f?text_field=Text&text_field2=Text2 -expected url
after type
你可以这样做-
cy.url().then(url => {
cy.visit(url + 'text_field=Text&text_field2=Text2')
});
cy.url将以字符串形式生成当前url。现在添加要添加的参数,并使用cy.visit访问新的url