0

I am learning Playwrignt for C# How can I get the result of

await Expect(locator).ToHaveValueAsync(value)

something like true or false?

Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63

1 Answers1

0

This is Assertion, it does not return anything, but will throw exception if expectation is not meet, otherwise just do nothing. In your case if element will not have desired value exception will be thrown. If you just want to check value without throwing exception you can do:

if(await locator.InputValueAsync() == "some value")
{
   // Do Something
}
Dzliera
  • 646
  • 5
  • 15