"Excelenium"ï¼ã¨ã¯ã»ã¬ãã¦ã ï¼ã§ï¼å¿«é©ãªèªåå帰ãã¹ããããï¼Seleniumã®ãã¹ãã¹ã¯ãªããã¨ãã¹ãä»æ§æ¸ãèªåçæï¼
ãã¹ãä»æ§ãæ¸ãã ãã§ï¼ä»æ§æ¸èªèº«ããã¹ããèªåã§ãã£ã¦ãããã
ãããExceleniumï¼ã¨ã¯ã»ã¬ãã¦ã ï¼ã
ãããExceleniumãï¼ãExcelãï¼ãSelenium
- å·¦å´ã§ï¼æä½ã®ã¹ããããæ¥æ¬èªã§æ¸ãã¨ï¼
- å³å´ã§ï¼ãã¹ãä»æ§æ¸é¢¨ã®ãã©ã¼ãããã®æç« ããªã¢ã«ã¿ã¤ã ã§èªåçæãã¦ãããã
- â»ç»åä¸ã§ã確èªãã¨æ¸ãã¦ããã®ã¯ï¼ãã§ãã¯ãã¤ã³ãã®é¨åãããã¯èªåçã«ãªã¬ã³ã¸è²ã®ã»ã«ã«ãªãã
æ¸ãå¿ è¦ãããã®ã¯ï¼éãç·ããå·¦å´ã ãã
ããã¦ï¼ ããã®ä»æ§æ¸ã®å ¨ãã¹ããå®è¡ã ã¨ãããã¿ã³ãæ¼ãã¨ã»ã»ã»
- Seleniumã®ãã¹ãã±ã¼ã¹ãèªåçæããï¼
- ãã©ã¦ã¶ãç«ã¡ä¸ããï¼
- ãã¹ãä»æ§æ¸ã«æ¸ãã¦ãã£ãå ¨ãã¹ããå®è¡ãããã
ï¼â»ã¤ãã§ã«ï¼ã·ã¼ãä¸ã®å
¨ãã¹ãã±ã¼ã¹ã«èªåã§çªå·ãæ¯ããããï¼
Webã¢ããªã±ã¼ã·ã§ã³ã®çµåãã¹ã / å帰ãã¹ãã大å¹
ã«æ¥½ã«ãªãã
- å¾æ¥ã®ãããªããã¹ãä»æ§æ¸ãã¨ç§°ãã¦ï¼ã ãã ãã¨é·ãæç« ãæå ¥åããããï¼ãããè¦ãªããæã¨ç®è¦ã§é å¼µã£ã¦æ¯åä¸ã¤ä¸ã¤æä½ã»ç¢ºèªãã¦ããï¼ã¨ããå¿ è¦ã¯ãªããªãã
- ã¾ãï¼ãã¹ãã¹ã¯ãªããã ãã§ããã¥ã¡ã³ãããªãã¨ããç¶æ
ãé²ãããæç« ã®å½¢ã§åºåãããã¨ã«ãã£ã¦å¯èªæ§ãåä¸ã§ããã®ã§ï¼ãã¹ãã®è³ªãåå³ãããããªãã
Exceleniumã§ã¯ï¼ãã¹ãã¹ã¯ãªããã表示ããã«ï¼æ¥æ¬èªã®æç« ã®é¨åã ããç¬ç«ãã¦å°å·ãããã¨ãå¯è½ãªããã«ãã¼ã¸åããã¦ããã
注ï¼
- æè¡è ã¯å¾ã¦ãã¦ï¼ãã¹ãã¹ã¯ãªããããããã°ãã¹ãå®è¡ã®è¨¼æ ãã¤å質ã®æ ä¿ã«ãªãï¼ã¨èãããããããä¸è¬ã®äººã ãã¯ããã§ã¯ç´å¾ããªãããã¹ãã®è¨¼æ ãæ¥æ¬èªã§æ¸ããã¦ããªãã¨ï¼ä½ããã¹ãããã®ãããã£ã¦ããããªããï¼ãã¹ããå®æ½ããäºããä¿¡ãã¦ããããªãã
- ãªã®ã§ï¼ãã¹ãã¹ã¯ãªããããæ¥æ¬èªã®ããã¥ã¡ã³ããèªåçæããã°ããããéçºã®è¶³ãã²ã£ã±ãã ãã®ããã¥ã¡ã³ããªã®ã«ï¼æ±ºã¾ãä¸æåºãæ±ãããã¦ãããã¨ããç©ã«ï¼ç¡é§ã¾ãç¡æå³ãªå´åãå²ãããªãã¦æ¸ãããã«ãªãã
Exceleniumã¯ãã¡ããããã¦ã³ãã¼ãã§ãã¾ãã
Excelenium ï¼ãã¹ã対象ã¨ãã¦ï¼Ruby on Rails ã®ãµã³ãã«ã¢ããªã¤ãï¼
以ä¸ã¯ï¼ä½¿ãæ¹ã
使ã£ã¦ã¿ãã
åé ã®ãªã³ã¯ãã excelenium.lzh ããã¦ã³ãã¼ããï¼è§£åã
å梱ç©ã¯
- ãã¹ãä»æ§æ¸ã¨ãªãExcelã·ã¼ãï¼test_01_keisan.xlsã¨ããååï¼
- ãµã³ãã«Railsã¢ããªã±ã¼ã·ã§ã³ï¼controller + viewï¼
ã®ï¼ç¹ã
ãã¹ã対象ã¯ä½ã§ãããã®ã ãï¼ããã§ã¯å梱ããã¦ããRailsã¢ããªããã¹ããã¦ã¿ããï¼â»DBã¯ä¸è¦ï¼
以ä¸ã§ã¯ï¼ãã¼ã«ã«PCã« Ruby on Rails ã®åä½ç°å¢ãããäºãåæã«ããã
ï¼â»ããã¾ã§ãã¹ã対象ã®ã¢ããªã¨ãã¦Railsã使ãã ãã§ããï¼Exceleniumèªä½ã®åä½ã«ã¯Rubyã¯ä¸è¦ãï¼
seleniumã®æºå
ã¾ãï¼selenium core ããã¦ã³ãã¼ããã¦è§£åã
Selenium-Core: Download
Railsã®publicãã©ã«ãå
ã«ç½®ãã¦ï¼ãã©ã«ãåãseleniumã«ãªãã¼ã ã
ãã¹ã対象ã¢ããªã®æºå
ä¸è¨ã§å ¥æãããµã³ãã«ã¢ããªå ã®
- controllers\hoges_controller.rb
- views\index.rhtml
- views\get_month.rhtml
ãï¼ãã¼ã«ã«ã®Railsã®appãã©ã«ãå ã®é©åãªä½ç½®ã«è¨ç½®ã
ruby script\server
ã§Webrickãµã¼ããèµ·åã
ãï¼ããããã¢ã¯ã»ã¹å¯è½ã§ãããã¨ã確èªããã
ã·ã¼ãä¸ã§ç°å¢è¨å®
ä¸è¨ã§å ¥æãããã¹ãä»æ§æ¸ç¨ã®Excelã·ã¼ããï¼å¥½ããªå ´æã«ç½®ãã
ãåæè¨å®ãã·ã¼ããéãã
以ä¸ã®é ç®ãè¨å ¥ããã
- ãã¹ã対象ã·ã¹ãã åã¨ï¼ãã®èå¥åã
- ï¼ã¤ã®ã·ã¹ãã ã®çµåãã¹ãä»æ§æ¸ãè¤æ°ã®ãã¡ã¤ã«ã«åå²ããå ´åï¼ã©ã®ãã¡ã¤ã«ã§ããã®æ¬ã«ã¯åããã®ãæ¸ããã¨ã«ãªãã
- ãã®ããã¯ã®ãã¹ã対象æ©è½åã¨ï¼ãã®èå¥åã
- ãã®ããã¯ã«åºæã®ãã¹ã対象ç¯å²ããã®ããã¯ãçæãããã¹ãã¹ã¯ãªããã®ãã¡ã¤ã«åã«ã¯ï¼ãã®èå¥åãå«ã¾ãããã¨ã«ãªãã
- seleniumè¨ç½®ãã¹ã
- Railsã®å ´åã¯ï¼åé ã§è¨ç½®ããpublicãã©ã«ãå ã®seleniumãã©ã«ãããã®ä¸ã«ãã¹ãã¹ã¯ãªãããçæãããã
- seleniumã®ã«ã¼ãURLã
- Webrickãµã¼ãã®å ´åã¯ãhttp://localhost:3000/selenium/ãã®ããã«ãªããApacheãªã:3000ã¯ä¸è¦ã
- ã·ã¼ãã®çµããã¨ã¿ãªãããã«å¿
è¦ãªç©ºè¡ã®æ°ã
- ã·ã¼ãå ã§ãã®æ°ã ã空è¡ãç¶ãã¨ï¼ããããä¸ã®è¡ã¯èªã¿åãããªãã
- ãã©ã¦ã¶å¼ã³åºãã³ãã³ãã
- ãããæ¸ãæããã°ï¼ããããªãã©ã¦ã¶ã§ãã¹ãã§ããã
ç»é¢é ç®ãã¹ã¿ãæ¸ã
ãé ç®ãã¹ã¿ãã¨ããã·ã¼ããéãã
ããã«ï¼ãã¹ãæã«ä½¿ãï¼seleniumããæä½ããï¼ç»é¢ä¸ã®é
ç®ã®æ
å ±ãæ¸ãã
- é
ç®å称ã®åï¼é
ç®ã®æ¥æ¬èªåï¼ããããããè«çåï¼ã
- ãã¹ãã±ã¼ã¹ç¨ã®ã·ã¼ãã«ãã¹ãä»æ§ãæ¸ãéã«ã¯ï¼ãã®æ¥æ¬èªå称ã使ããã
- é
ç®å
容ã®åï¼é
ç®ãä¸æã«ç¹å®ããç©çåã
- ãã¹ãä»æ§ãããã¹ãã¹ã¯ãªãããçæããéï¼è«çåããã®ç©çåã«å¤æãããã
é
ç®ã¨ãã¦ã¯ï¼
- URLã«ãã¼ã¸åãä»ãã
- DOMè¦ç´ ã«ã¦ã¼ã¶ãã¬ã³ããªã¼ãªè¦ç´ åãã¤ãã
ãªã©ãå¯è½ãç©çåã«ã¯xpathã使ããã
ã³ãã³ãä¸è¦§ãè¦ã¦ãã
ãã³ãã³ãä¸è¦§ãã·ã¼ããè¦ã¦ãããã
- æä½ç¥ç§°ï¼è¡ãªãããæä½ã®ç¥ç§°ã
- ãã¹ãä»æ§ã¯ããã使ã£ã¦è¨è¿°ããããã®åã ãè¦ãã¦ããã°ï¼or æ¸ãã¦ãæä¸ã«åç §ã§ããããã«ãã¦ããã°ï¼ããã
- 説æ表示ã®ãã³ãã¬ã¼ãï¼ãã¹ãä»æ§æ¸é¢¨ã®æç« ã®ãã³ãã¬ã¼ãã
- ã·ã¼ãå·¦å´ã§æä½ç¥ç§°ã使ã£ã¦æ¸ãããã®ã¯ï¼ã·ã¼ãå³å´ã§ãã®æç« ã«èªåçã«å¤æãããã
- ã³ãã³ãï¼seleniumãå©ç¨ããã³ãã³ãã
- ãã¹ãã¹ã¯ãªããã§ã¯æä½ç¥ç§°ãããã«å¤æãããã
ç¨æããã¦ãããã¹ããå®è¡ãã¦ã¿ãã
ããã§ï¼è©¦ãã«ãµã³ãã«Railsã¢ããªããã¹ããã¦ã¿ããã
ã01_足ãç®ï¼æ£å¸¸ç³»ï¼ãã®ã·ã¼ããéãï¼ããã®ä»æ§æ¸ã®å ¨ãã¹ããå®è¡ããã¿ã³ãæ¼ä¸ããã
åæè¨å®ã·ã¼ãã®å 容ãæ£ãããã°ï¼ãã©ã¦ã¶ãèµ·åãï¼seleniumã®TesuRunnerã®ç»é¢ãç¾ããã
ç»é¢å³å´ã®ç·è²ã®ä¸è§ã®ãã¿ã³ãæ¼ãã¨ï¼ãã¹ããå®è¡ãããã
ã¹ãã¼ãã¯ç»é¢å³ä¸ã®ã¹ã©ã¤ãã§èª¿ç¯ã§ããã
â»seleniumã®åºæ¬çãªä½¿ãæ¹ã®å ¥éã¯ï¼ä¸è¨ã®è¨äºãåç §ã
ä»ããï¼å㧠selenium ã®ä½¿ãæ¹ã身ã«ä»ããã(å帰ãã¹ãèªåå)
http://language-and-engineering.hatenablog.jp/entry/20081016/1224080409
èªåã§ãã¹ããæ¸ãã¦ã¿ãã
ãã³ãã³ãä¸è¦§ãã®ã·ã¼ãã¯ï¼å°å·ãã¦æå ã«æã£ã¦ããã¨ããã
ãããè¦ãªãããªãï¼èªåã§ãã¹ããæ¸ããããã ããã
æ°è¦ãã¹ããæ¸ãã«ã¯ä¸è¨ã®ããã«ããã
- ããã¹ãã±ã¼ã¹åç´ããã³ãã¼ã
- ã·ã¼ãåã¨ãã¦ï¼ãã¹ã対象ã®æ©è½ã®å°åºååãæ¸ãããã®ã·ã¼ãåãèªåçã«ã·ã¼ãå·¦ä¸ããã¹ã対象æ©è½ï¼å°åºåãã®ã»ã«ã«åæ ãããã
- ãã¹ãã®ã¹ããããæ¸ãã¦ããã
- ãã¹ãã±ã¼ã¹æ¦è¦ã®åã«ï¼ã¹ãããã®ã¾ã¨ã¾ãã®èª¬æãæ¸ãã
- ããã®å ´åããªã©ã
- æä½ç¥ç§°ã®åã«ï¼ã³ãã³ãä¸è¦§ã®æä½ç¥ç§°ãæ¸ãã対å¿ããå¼æ°ãæ¸ãã
- ä¼¼ãã±ã¼ã¹ã¯ã³ããã§æ¸ã¾ããã¨æ¥½ã
- ã¹ãããã®åã«ä½ãæ¸ãã¨ï¼ãã®è¡ã¯ãã¹ãå®è¡ãããªãã
- ãã¹ãã±ã¼ã¹æ¦è¦ã®åã«ï¼ã¹ãããã®ã¾ã¨ã¾ãã®èª¬æãæ¸ãã
ä¾é¡ï¼
- ã02_çµéææ°ã®è¨ç®ãã®ã·ã¼ãã§ï¼7ã12æã®ãã¹ãã±ã¼ã¹ãæ¸ãã¦ï¼å®è¡ãã¦ã¿ã¾ãããã
- ãã¹ãã§NGãåºããï¼http://language-and-engineering.hatenablog.jp/entry/20090314/p1ããåèã«ï¼ã¢ããªãä¿®æ£ãã¦ã¿ã¾ãããã
- ä¿®æ£å¾ã®ã¢ããªã§ï¼ãã¹ãçµæããªã¼ã«ã°ãªã¼ã³ã«ãªãäºã確èªãã¾ãããã
ã§ã¯ï¼æ¥½ãããã¹ãã¨ï¼æ¥½ããéçºãã
è£è¶³è¨äºï¼
Selenium ä¸ç´è ã«ãªãã ï¼å¤æ°ï¼XPathï¼JavaScriptãï¼ãã¹ãã±ã¼ã¹ä¸ã§å©ç¨ããæ¹æ³ï¼
http://language-and-engineering.hatenablog.jp/entry/20090818/p1
IE AutoTester ã§ï¼UIã®å帰ãã¹ããå®å ¨èªåå
http://language-and-engineering.hatenablog.jp/entry/20090922/p1
ãå®è¡å¯è½ããã¥ã¡ã³ãããæºããã¹ãæ§è³ªãâããã¹ãèªååãã¼ã«ãExceleniumãã§ä½¿ããã¦ããæè¡ãææ³
http://language-and-engineering.hatenablog.jp/entry/20101112/p1
ã