Hatena::¥Ö¥í¥°(Diary)

tabizou ¤ ÎÆüµ

2017-09-30

nodejs + chromedriver ¤ ò »î ¤ · ¤ Æ ¤ ß ¤ ë

22:24

´ Ķ ¤ ÏWin10 Pro x64 + nodejs 8.6 + chromedriver-2017/08/30

chromedriver ¤ Ï SeleniumBasic ¤ ÈƱµï ¤ µ ¤ »¤ ë

SeleniumBasic ¤ Ï ¤ ³ ¤ Á ¤ é ¤ «¤ é ¥ À ¥ ¦ ¥ ó ¥ í¡¼ ¥ É

exe ¤ ò¼Â ¹ Ô ¤ ¹ ¤ ë ¤ È¡ ¢ C:\Users\user_name\AppData\Local\SeleniumBasic ¤ Ë ¥ ¤ ¥ ó ¥ ¹ ¥ È¡¼ ¥ ë ¤ µ ¤ ì ¤ ë

chromedriver ¤ Ï ¤ ³ ¤ Á ¤ é ¤ «¤ é ¥ À ¥ ¦ ¥ ó ¥ í¡¼ ¥ É

¤ · ¤ Æ SeleniumBasic ¤ Îchromedriver ¤ ˾å½ñ ¤ ¤ ¹ ¤ ë

> npm install selenium-webdriver
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN nodejssamp@1.0.0 No description
npm WARN nodejssamp@1.0.0 No repository field.

//+ selenium-webdriver@3.5.0
added 30 packages in 14.251s

    var webdriver = require('selenium-webdriver'),
        By = webdriver.By,
        until = webdriver.until;

    var driver = new webdriver.Builder()
        .forBrowser('chrome')
        .build();

    driver.get('http://www.google.co.jp¡Ç)
    driver.findElement(By.name('q')).sendKeys('webdriver')
    driver.findElement(By.name('btnG')).click()
    driver.wait(until.titleIs('webdriver - Google Search'), 1000)
//    driver.quit();

¥ È ¥ é ¥ Ã ¥ ¯ ¥ Ð ¥ Ã ¥ ¯ - http://d.hatena.ne.jp/tabizou/20170930/1506777880