Skip to content

Instantly share code, notes, and snippets.

package com.yokogoshi.line_intent_test;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
$ wget http://selenium.googlecode.com/files/selenium-server-standalone-2.38.0.jar
$ sudo yum install java-1.7.0-openjdk.x86_64 java-1.7.0-openjdk-devel.x86_6
$ sudo wget -qO- https://gist.github.com/alingogo/5325484/raw | sudo bash
$ sudo yum install firefox
$ sudo yum install Xvfb
$ sudo yum groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
$ Xvfb :99 -ac -screen 0 1280x1024x24 -extension RANDR &
$ export DISPLAY=:99
$ java -jar /path/to/selenium-server-standalone-2.38.0.jar &
$ wget https://php-webdriver-bindings.googlecode.com/files/php-webdriver-bindings-0.9.1.zip
$ unzip php-webdriver-bindings-0.9.1.zip
<?php
require_once dirname(__FILE__) . "/phpwebdriver/WebDriver.php";
require_once dirname(__FILE__) . "/phpwebdriver/LocatorStrategy.php";
$URL = "http://example.com/";
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("firefox");
//サイトアクセス
$webdriver->get($URL);