Go to file
R. Eric Wheeler 0736ff9b80 Oops 2016-12-22 13:08:26 -08:00
Tests Added ImageDownloader class 2016-12-22 12:24:54 -08:00
bin Final 2016-12-20 14:32:00 -08:00
src/Sikofitt Added ImageDownloader class 2016-12-22 12:24:54 -08:00
.gitignore Final 2016-12-20 14:32:00 -08:00
.php_cs Added ImageDownloader class 2016-12-22 12:24:54 -08:00
CHANGELOG.md Update CHANGELOG.md 2016-12-22 08:00:53 -08:00
LICENSE Add license 2016-12-20 09:33:43 -08:00
README.md Added ImageDownloader class 2016-12-22 12:24:54 -08:00
composer.json Final 2016-12-20 14:32:00 -08:00
composer.lock Added ImageDownloader class 2016-12-22 12:24:54 -08:00
example.php Oops 2016-12-22 13:08:26 -08:00
phpunit.xml Final 2016-12-20 14:32:00 -08:00

README.md

Selenium Tor Implementation for facebook/php-webdriver

Usage

Install Composer

  • curl -SsL https://getcomposer.org/installer|php
  • mv composer.phar /usr/local/bin/composer

Get the code

  • Clone the repository git clone https://repos.bgemi.net/sikofitt/selenium-tor
  • cd selenium-tor

Install dependencies

  • Then install the dependencies with composer install

Get tor if you don't have it

  • composer download or
  • bin/console tor:download
use Sikofitt\WebDriver\FirefoxBinary;
use Sikofitt\WebDriver\Remote\DesiredCapabilities;
use Sikofitt\WebDriver\Tor\TorProfile;
use Sikofitt\WebDriver\TorLauncher;


require 'vendor/autoload.php';

$firefoxBinary = new FirefoxBinary(__DIR__ . '/../tor-browser_en-US/Browser/start-tor-browser');
$caps = DesiredCapabilities::tor($firefoxBinary);
$profile = new TorProfile();
$caps->setCapability('timeout', 3600);
$caps->setCapability(FirefoxDriver::PROFILE, $profile);

$torProcess = TorLauncher::launch($firefoxBinary);
// Wait for Tor to connect
sleep(2);
$webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $caps);
$webDriver->navigate()->to('http://32b5oz2bbtn6gqj3.onion');
// Or $this-webDriver->get('http://32b5oz2bbtn6gqj3.onion');
$pageImages = $webDriver->findElements(WebDriverBy::tagName('img'));
$images = [];
foreach($pageImages as $image)
{
    $images[] = $image->getAttribute('src');
}
TorLauncher::stop($torProcess);

Tests

composer test'