See changelog
This commit is contained in:
parent
b02ac1e137
commit
6df270415b
|
@ -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.
|
15
example.php
15
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();
|
||||
|
|
Loading…
Reference in New Issue