[Question]
See original GitHub issueHey, I am migrating tests from Cypress to Playwright and we had a couple of tests that were testing some elements on the SSR. Is it possible to achieve an equivalent behavior to the Cypress one from this article?
With Cypress, we were able to use selectors on the $html
from the response, I’m not sure if that’s doable with Playwright.
I tried both:
const response = await page.goto()
/const response = await request.get()
Then to apply the response.text()
I can see the server-side HTML as a string but I cannot use any selectors on it.
I would appreciate any advice on how to test SSR HTML, thank you.
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
System Of A Down - Question! (Official HD Video) - YouTube
Official HD music video for ” Question !" by System of a DownListen to System of a Down: https://SystemOfADown.lnk.to/listenYDSubscribe to the ...
Read more >Question Definition & Meaning - Merriam-Webster
noun ; b · a subject or aspect in dispute or open for discussion : issue ; d · the specific point at...
Read more >Question Definition & Meaning | Dictionary.com
a problem for discussion or under discussion; a matter for investigation. a matter of some uncertainty or difficulty; problem (usually followed by of):...
Read more >Meaning of question in English - Cambridge Dictionary
a sentence or phrase used to find out information: The police asked me questions all day. Why won't you answer my question?
Read more >question - Wiktionary
NounEdit · A sentence, phrase or word which asks for information, reply or response; an interrogative. · A subject or topic for consideration...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I guess that would depend what you are testing for. If your aim is to test the user experience on different browsers/devices/screen sizes/etc, then you’re better off using the various web api’s exposed by playwright.
Based on the simple example you’ve given, if you change the html tag from
nav
toheader
(ordiv
tospan
, etc) for whatever reason, your test will fail even though nothing would change from the end user’s perspective. If you use playwright’s locators however, your tests will continue to pass regardless of the implementation details.Closing as per above. Thanks @ambiguous48 for the great explanation!