1. 2
  1.  

      1. 6

        There’s also headless Firefox, and a phantomjs equivalent… in case you don’t want to perpetuate the chrome monopoly

        https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode

        https://github.com/laurentj/slimerjs

        1. 1

          Perfect – Interested to see how the various headless libraries compare. FF seems like a better option than Chrome; will find out.

    1. 2

      A lot of ‘mechanic’^Wtesting inventory still uses PhantomJS. Does surprise me the number of ad verification companies still unable to detect this, though this probably explains its prevalence :)

      1. 2

        This project seems not very much alive. https://github.com/ariya/phantomjs/issues/15344

        1. 1

          Tru. Am basically using it to grab a page’s post-JS-executed HTML source to then pipe into other utilities in BASH, which seems to work fine. Will see if it catches fire with more complicated scripts.

          There’s also this:

        2. 2

          Looks pretty interesting. One of my friends was trying to rig an online poll at my school, so he went through the trouble of getting Python to open up his web browser and interact with his screen. It was a very finicky thing to do since he effectively couldn’t use his computer while it was running. With this, it would have been a heck of a lot easier. Sad to see that development is effectively over at this point.

          1. 2

            The other option that might have worked there is Selenium WebDriver:

            It was a very finicky thing to do since he effectively couldn’t use his computer while it was running

            Using a VM/container also helps with preventing scripts that emulate the browser from constantly taking focus when windows are opened/closed/other.

            1. 1

              Selenium is a ball ache[1] but mostly can be called upon by creating a python virtual environment just with:

              virtualenv --python=python3
              ./bin/pip install selenium
              

              You can then grind through the usual python tutorials to solve your problem[2]; PhantomJS supporting a webdriver socket helps too.

              IIRC you can make Firefox/Chrome less crap if you specify a profile directory to use so that it does not piggyback and couple its-self to any existing instances of it already running.

              [1] though probably more due to my experience of dealing with BrowserStack being a PoS

              [2] I personally then drive Python via a pipe using a less-awful language…such as Erlang or Perl :)

              1. 1

                It shouldn’t create visible windows if Chrome is started with --headless and Firefox with -headless.

            2. 1

              We used PhantomJS extensively at my last 2 gigs, it is (or was) pretty common in the Rails ecosystem. Despite the project not being maintained, for some time there was no alternative. I guess I can’t compare it to much else, but it certainly fulfilled a need on Rails teams for me personally for the past ~5 years, and I have a lot of goodwill toward the maintainers on that account.