I want to compare the value found at a locate to a given value. using Playwright and Typescript

  Kiến thức lập trình

I enter a value in search criteria and get a list of transactions. I can then select one of the returned transaction and select the Details page of that transaction. This is working.

I then want to go to the locate where that value is displayed, AND PULL THE DISPLAYED VALUE AND COMPARE TO THE INPUT USED. I have been able to do everything UP TO the PULL AND COMPARE.

The value is inside a ‘cell’ on the details page.

It seems like Playwright is trying to compare the actual locator to my entered value, and NOT the value in the cell AT that locator.

The inPutValue is dynamic, so I don’t specify it in the script; instead I have a variable that I reference both when entering it into the search criteria, and when doing the compare.

After navigating to the detail page (which works fine), I tried the below and variants of them:

const pageLocator(‘locator’)
// expect(pageLocator).toEqual(expect.stringContaining(inPutValue))

and
expect(this.Locator).toHaveValue(inPutValue)

THANK YOU FOR ANY HELP.

LEAVE A COMMENT