See changelog

This commit is contained in:
R. Eric Wheeler 2016-12-22 13:02:55 -08:00
parent b02ac1e137
commit 6df270415b
2 changed files with 20 additions and 2 deletions

View File

@ -1 +1,6 @@
#initial 2016-12-20 #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.

View File

@ -5,9 +5,21 @@ use Sikofitt\WebDriver\ImageDownloader;
use Sikofitt\WebDriver\Remote\DesiredCapabilities; use Sikofitt\WebDriver\Remote\DesiredCapabilities;
use Sikofitt\WebDriver\Tor\TorProfile; use Sikofitt\WebDriver\Tor\TorProfile;
use Sikofitt\WebDriver\TorLauncher; use Sikofitt\WebDriver\TorLauncher;
use Symfony\Component\Process\ProcessBuilder;
require __DIR__ . '/vendor/autoload.php'; 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'); $firefoxBinary = new FirefoxBinary(__DIR__ . '/tor-browser_en-US/Browser/start-tor-browser');
$caps = DesiredCapabilities::tor($firefoxBinary); $caps = DesiredCapabilities::tor($firefoxBinary);
@ -29,6 +41,7 @@ $webDriver->navigate()->to('http://32b5oz2bbtn6gqj3.onion');
$pageImages = $webDriver->findElements(WebDriverBy::tagName('img')); $pageImages = $webDriver->findElements(WebDriverBy::tagName('img'));
$images = []; $images = [];
$downloader = new ImageDownloader(); $downloader = new ImageDownloader();
foreach($pageImages as $image) foreach($pageImages as $image)
{ {
@ -57,4 +70,4 @@ foreach($pageImages as $image)
} }
TorLauncher::stop($torProcess); TorLauncher::stop($torProcess);
$process->stop();