Reputation: 191
Here is the inspect element
I am trying to fetch the WO No. When I click on WO No, I get following and I store it in WONo
const WONo = page.getByLabel('WO No')
When I print it I get following, While to my understanding it should return 12204 as showin in the pink the pink area. Am, I understanding the whole thing incorrectly?
Locator@internal:label="WO No"i
Any Hint/help will be appreciated. I am using typescript with plauwright. BR
Upvotes: 1
Views: 2298
Reputation: 1
Try using this extension for getting the playwright path from the browser. https://chromewebstore.google.com/detail/letxpath/bekehlnepmijedippfibbmbglglbmlgk
Upvotes: 0
Reputation: 3408
Try to use innerText()
, textContent()
, inputValue()
.
Or the same functions for page.getByLabel('WO No').locator("input")
, if innerText doesn't work
Upvotes: 1
Reputation: 1045
The return type of get_by_label
is locator so you may need to do nested findings, get the input, and then read its value.
const WONo = await page.get_by_label('WO No')
const WONo_value = await WONo.get_by_role('textbox').input_value()
Upvotes: 1