playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] changing visibilityState

Open kapouer opened this issue 6 years ago • 5 comments

Being able to change document.visibilityState (and consequently document.hidden) would be nice:

  • to test what some code does when hidden, prerender or visible
  • to test visibilitychange events and how code behave w.r.t. those properties

kapouer avatar Mar 09 '20 01:03 kapouer

It should work with Object.defineProperty(document, 'visibilityState', {get() { return "prerender";}}) i don't know why i opened that issue. Closing.

kapouer avatar Mar 19 '20 15:03 kapouer

@kapouer can you please put the snap of the code where you implemented this. Need to do same.

abhayp5 avatar Jun 11 '20 06:06 abhayp5

@abhayp5 https://github.com/kapouer/express-dom/blob/ef720a5b84e834ff951b9241788b63285c00e59b/lib/plugins.js#L98-L105 but there are tons of examples like that

kapouer avatar Jun 11 '20 06:06 kapouer

thank you it really helped. able to achieve using page.evaluateHandle() function.

abhayp5 avatar Jun 12 '20 09:06 abhayp5

Can you tell me how you changed the visibilityState with some code please

nowayX avatar Oct 08 '20 23:10 nowayX