ã¯ããã¦ã®seleniumãã
æ¥åèªååè¨ç»ãã®ï¼ãselenium
ç°¡åãªå°å ¥æ¹æ³ããï¼
ã¾ãã¯pom.xmlã®è¨å®
<dependency> <groupId>org.seleniumhq.selenium.server</groupId> <artifactId>selenium-server</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium.client-drivers</groupId> <artifactId>selenium-java-client-driver</artifactId> <version>1.0.1</version> </dependency>
ãã¡ãããSelenium Serverããã¦ã³ãã¼ãDownloads
ã¦ãã¨ã¼ãªå ´æã«ãããããã¿ã¼ããã«ã§ä¸è¨ã³ãã³ããå®è¡
java -jar selenium-server-standalone-2.0b3.jar
ãµã³ãã«ã³ã¼ãæ¸ããã¨æã£ããã©ä½ãæãã¤ããªãã£ãã®ã§ãgmailãã°ã¤ã³æ¹æ³
ï¼ãªã«ãæãã¤ãããæ¸ãï¼
package jp.ne.hatena.syoko_sasaki; import com.thoughtworks.selenium.SeleneseTestCase; public class SeleniumTest extends SeleneseTestCase { @Override public void setUp() throws Exception { setUp("http://mail.google.com/mail?hl=ja", "*firefox"); } public void testname() throws Exception { selenium.open("/"); selenium.type("name=Email", "ã¢ã«ã¦ã³ã"); selenium.type("name=Passwd", "ãã¹ã¯ã¼ã"); selenium.click("name=signIn"); selenium.waitForPageToLoad("30000"); } }
httpsã®ãã¼ã¸ã§ãå³ã¯ãªãã¯ãã¦ã½ã¼ã¹ã表示ãããæ®éã«ã§ã¦ããã®ã«ãselenium.getHtmlSource()ãããbodyãã¬ã©ç©ºããªã®ããã£ã¦ã¡ãã£ã¨ã³ã£ããããã