napperley
09/08/2018, 5:12 AMnapperley
09/08/2018, 5:28 AMCoroutine failed: Error: Execution context was destroyed, most likely because of a navigation.
❔napperley
09/08/2018, 5:37 AM@Test
fun testDomManipulation() {
launch {
val url = "<https://www.test.com>"
val browser = Puppeteer.launch().await()
val page = browser.newPage().await()
val options = mapOf("timeout" to 10000)
page.goto(url, options).await()
println("Running page operation...")
val resultHandle = page.evaluateHandle({
// Do something here...
"""{ "msg": "Page operation complete"}"""
}).await()
println("Result: ${resultHandle.jsonValue().await()}")
resultHandle.dispose().await()
browser.close()
}
}
napperley
09/08/2018, 5:49 AM