Menu

[r12]: / trunk / examples / googleSearchTest.lua  Maximize  Restore  History

Download this file

36 lines (28 with data), 895 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--[[
Simple Google Search test.
Purpose: to demonstrate the following Lua Selenium Diriver functionality:
* entering text into a text field
* clicking a button
* checking to see if a page contains text
]]
dofile("../lib/selenium.lua")
dofile("../lib/luaunit.lua")
TestGoogle = {} --Test class
function TestGoogle:setUp()
self.sele = selenium.new ('*iehta','http://www.google.com','127.0.0.1','4444','3000')
self.sele:start()
end
function TestGoogle:test_Search()
self.sele:open('/')
self.sele:waitForPageToLoad('3000')
self.sele:type('q','Lua Programming')
self.sele:click("btnG")
self.sele:waitForPageToLoad('3000')
res = self.sele:isTextPresent('The Programming Language Lua')
assertEquals(res,true)
end
function TestGoogle:tearDown()
self.sele:stop()
end
-- will execute only one test
LuaUnit:run('TestGoogle:test_Search')
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.