Javascript Injection With Selenium, Puppeteer, And Marionette In Chrome And Firefox 有更新!
Browser automation frameworks–like Puppeteer, Selenium, Marionette, and Nightmare.js–strive to provide rich APIs for configuring and interacting with Web browsers. These generally work quite well, but you’re inevitably going to end up running into API limitations if you do a lot of testing or Web scraping. You might find yourself wanting to conceal the fact that you’re using a headless browser, extract image resources from a Web page, set the seed for Math.random()
, or mock the browser’s geolocation before running your test suite. Your specific automation framework might provide a built-in way to accomplish some of these, but they all have their limitations.