2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Selenium のサンプル 予約フォーム (Node.js)

Posted at

Selenium のサンプルです。

次のページをテストに使いました。
予約フォーム

reaerve_form.js
# ! /usr/bin/node
// ---------------------------------------------------------------
//	reserve_form.js
//
//					Sep/21/2018
//
// ---------------------------------------------------------------
console.error ("*** 開始 ***")

var webdriver = require('selenium-webdriver')
var By = require('selenium-webdriver').By

var driver = new webdriver.Builder().forBrowser('firefox').build()
const url = 'http://example.selenium.jp/reserveApp'
driver.get(url)

driver.findElement(By.id('reserve_month')).clear()
driver.findElement(By.id('reserve_month')).sendKeys('11')

driver.findElement(By.id('reserve_day')).clear()
driver.findElement(By.id('reserve_day')).sendKeys('10')

driver.findElement(By.id('reserve_term')).clear()
driver.findElement(By.id('reserve_term')).sendKeys('3')

driver.findElement(By.id('headcount')).clear()
driver.findElement(By.id('headcount')).sendKeys('2')

var str_select = "input[type='radio'][name='bf'][value='off']"
var item=driver.findElement(By.css(str_select))
item.click()

str_select = "input[type='checkbox'][id='plan_b']"
item=driver.findElement(By.css(str_select))
item.click()

driver.findElement(By.id('guestname')).sendKeys('明智小五郎')
driver.findElement(By.id('goto_next')).click()

console.error ("*** 終了 ***")

// ---------------------------------------------------------------
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?