Last active
December 21, 2015 08:59
-
-
Save masayuki5160/6282300 to your computer and use it in GitHub Desktop.
参考サイトのまんま。 JavaScriptのクリックイベントまでしてくれる。 まだよくわかってないけど参考になるソースなのでメモ。 http://blog.asial.co.jp/1180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
public class Test { | |
public static void main(String[] args) { | |
RemoteWebDriver driver = new FirefoxDriver(); | |
driver.get("http://www.asial.co.jp"); | |
sleep(1000); | |
WebElement element = driver.findElement(By.cssSelector("ul.flex-direction-nav a.prev")); | |
for (int i=0; i<5; i++) { | |
driver.executeScript("arguments[0].click();", element); | |
sleep(3000); | |
} | |
//driver.quit(); | |
} | |
private static void sleep(int microtime) { | |
try { | |
Thread.sleep(microtime); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment