按照上面的步驟,搭建後的工程:
package com.dhy.selenium.test;
import org.openqa.selenium.by;
import org.openqa.selenium.webdriver;
import org.openqa.selenium.webelement;
import org.openqa.selenium.firefox.firefoxdriver;
import org.openqa.selenium.remote.remotewebdriver;
import org.openqa.selenium.remote.desiredcapabilities;
public class case1 {
public static void main(string[] args) throws exception{
// webdriver driver = new remotewebdriver(new url("http://localhost:4444/wd/hub"),
// desiredcapabilities.firefox());
webdriver driver = new firefoxdriver();
driver.get("http://2j.isurveylink.com/s/183/?test_mode=1");
webelement element = driver.findelement(by.id("start_btn"));
element.click();
try {
thread.sleep(3000);
} catch (interruptedexception e) {
// todo auto-generated catch block
e.printstacktrace();
}
system.out.println("page title is : " + driver.gettitle());
driver.quit();
這裡的文法啊、類啊什麼的,需要慢慢研究。
最新内容請見作者的github頁:http://qaseven.github.io/