4 ms·
Much better access to low-level information. You can hook (and mock) requests, see what POST data was sent and basically do lots of magic. Also, my experience w
by d33 7y ago
Much better access to low-level information. You can hook (and mock) requests, see what POST data was sent and basically do lots of magic. Also, my experience with Selenium under Python is that doing anything bigger quickly turns into one giant timing hack.
- rat87 7y agoback when I did selenium (with python) I wait-ed for the wait for next page to load (html element becomes stale) and for textbox/checkbox/etc. you are selecting to be present with a few tiny helper functions. That took most of the magic sleeps out although I still needed timeouts on the waits
- HunOL 7y agoIf it really E2E from user perspective you shouldn't doing any magic and manipulate POST data.
- danShumway 7y agoYou're not technically wrong, but unit/integration/E2E are not hard categories for tests, they're just points along a continuum. Sometimes I want to directly control a browser to run a test or examine a UI component, but I still want to mock parts of my application. This is one of the biggest weaknesses with Selenium -- it takes a very narrow view of what testing is, so it becomes much less useful as soon as you're trying to do anything interesting. Different applications call for different testing strategies. Selenium could be a low-level browser controller that allows you to write strict E2E tests, but instead it's a low-level browser controller that is almost fanatical about only supporting strict E2E tests, even when it means that basic actions need to be more complicated. I think that's a design mistake, but whatever.
- Qerub 7y ago> Sometimes I want to directly control a browser to run a test or examine a UI component, but I still want to mock parts of my application. If you're building a SPA, you can mock out the backend and control the backend mock behaviour in your Selenium test.
- danShumway 7y agoIt's not that Selenium makes it impossible to do things like this, it's that it makes it arbitrarily harder. If you want to do something like request interception, you have to point your front-end at a proxy server and mock things there. If you want to test a file upload, you have to simulate typing into the dialog and then use a literal file on the disk. It's just pointless friction for most testing setups. It's not that E2E testing is bad, it's that in some projects there's room for a Selenium-style tool across the entire spectrum from E2E testing to unit testing; particularly if I'm testing something like D3 code, or parts of a CSS layout. It's all doable, it's just that Selenium makes it all needlessly difficult, because its point-of-view is that your front-end should be treated mostly like a black box, and that any mocking that does exist should be happening via endpoints and application connectors. I like Selenium -- I prefer using an Open protocol over Puppeteer. I just feel like that protocol could use a lot more design work.
- bluntfang 7y ago>This is one of the biggest weaknesses with Selenium -- it takes a very narrow view of what testing is Selenium/WebDriver isn't a testing tool. It's a a W3C protocol for remote control of web browsers. I think once you get over that misconception, selenium starts to make a lot more sense.
- danShumway 7y agoThat still doesn't explain to me design decisions like how WebDriver's file upload works. If I'm remote-controlling a browser over a network, wouldn't I occasionally want to send it an arbitrary file upload? Why do I need to separately transfer the file using a different service, and then refer to it with the disk path? The only reason I can think of is, "normal users couldn't do that." But normal users also can't control a browser over a network. There's no reason to restrict a control protocol to only things that normal users can do.
- bluntfang 7y ago>There's no reason to restrict a control protocol to only things that normal users can do. The selenium maintainers seem to have a very strong opposite opinion.
- shawnz 7y agoThat is just further reason why it ought to support scenarios that the grandparent was describing, like modifying request data, even if that functionality is not useful for automated testing
- deleted 7y ago[deleted]
- Tinfoilhat666 7y agoDoes puppeteer work with Safari and MS browsers or is it another Chrome only tool (and now Firefox)?
- leadingthenet 7y agoIt's yet another Chrome only tool.
- hans-claasen 7y agoIt works very well for Microsoft Edge too (latest DEV version of it) - https://github.com/GoogleChrome/puppeteer/issues/4185#issuecomment-511648269 https://github.com/GoogleChrome/puppeteer/issues/4185#issuec...
- oneshore 7y agoYou mean it will work with Microsoft Edge when Microsoft Edge becomes Chrome.