I have written a async playwright function but I don't know how to put this assignement into my function , using await
.
Here is the line of code that cause me error :
country = await feedback.query_selector('[]').inner_text()
This is what I get in my console as error :
country = await feedback.query_selector('[]').inner_text()
AttributeError: 'coroutine' object has no attribute 'inner_text'
sys:1: RuntimeWarning: coroutine 'ElementHandle.query_selector' was never awaited
I would appreciate any help from you. Thank you !
CodePudding user response:
It should be: await (await feedback.query_selector('[]')).inner_text()
. But we discourage from using ElementHandles, see here: https://playwright.dev/docs/next/locators#locator-vs-elementhandle