From 6df270415b8fd83c257e5eb9649e60b236b83f20 Mon Sep 17 00:00:00 2001 From: sikofitt Date: Thu, 22 Dec 2016 13:02:55 -0800 Subject: [PATCH] See changelog --- CHANGELOG | 7 ++++++- example.php | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2484c16..e48fae4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1 +1,6 @@ -#initial 2016-12-20 \ No newline at end of file +#initial 2016-12-20 +# 2016-12-20 +* Added ImageDownloader class to get images through a curl proxy. +* Added process builder to example to start the selenium standalone, + so all you have to do is run php example.php, + you don't need a second terminal running the selenium server. \ No newline at end of file diff --git a/example.php b/example.php index 0be8db1..48af435 100644 --- a/example.php +++ b/example.php @@ -5,9 +5,21 @@ use Sikofitt\WebDriver\ImageDownloader; use Sikofitt\WebDriver\Remote\DesiredCapabilities; use Sikofitt\WebDriver\Tor\TorProfile; use Sikofitt\WebDriver\TorLauncher; +use Symfony\Component\Process\ProcessBuilder; require __DIR__ . '/vendor/autoload.php'; + +$selenium = new Symfony\Component\Process\ProcessBuilder(); +$selenium->setPrefix(__DIR__ . '/vendor/bin/selenium-server-standalone'); +$process = $selenium->getProcess(); +$process->wait(function() use($process) { + while(false == $process->isRunning()) { + print 'Waiting ...'; + } + return true; +}); + $firefoxBinary = new FirefoxBinary(__DIR__ . '/tor-browser_en-US/Browser/start-tor-browser'); $caps = DesiredCapabilities::tor($firefoxBinary); @@ -29,6 +41,7 @@ $webDriver->navigate()->to('http://32b5oz2bbtn6gqj3.onion'); $pageImages = $webDriver->findElements(WebDriverBy::tagName('img')); $images = []; + $downloader = new ImageDownloader(); foreach($pageImages as $image) { @@ -57,4 +70,4 @@ foreach($pageImages as $image) } TorLauncher::stop($torProcess); - +$process->stop();