Hello again!!
I am having trouble with this one, I try to change the conditions and add
other options but still I got the same error.. can someone help me? Thanks
a lot!
*this is my codes:*
require 'watir-webdriver'
require 'minitest/autorun'
require "win32ole"
class Login < Minitest::Unit::TestCase
$number_of_fails = 0
$number_of_success = 0
$fields = ["first_name", "middle_name", "last_name", "sss_number",
"tin_number"]
# $to_enter = ["Helfe", "padayao", "Marquez", "1234rer", "9387373"]
def test_in()
@browser =Watir::Browser.new :firefox
@browser.goto 'http://gw01.nextix.org/login'
accept_next_alert=true
@browser.driver.manage.window.maximize
excel= WIN32OLE::new("excel.Application")
wrkbook=excel.Workbooks.Open("C:\\testing\\inputs.xlsx")
wrksheet = wrkbook.worksheets(1)
wrksheet.select
rows = 2
while rows <= 5
$username = wrksheet.cells(rows, "A").value
$password = wrksheet.cells(rows, "B").value
@browser.text_field(:name, "username").set($username)
sleep 3
@browser.text_field(:name, "password").set($password)
sleep 3
@browser.button(:name => 'login').click
sleep 3
rows = rows + 1
end
$Dashboard = @browser.link(:text, "Dashboard")
$Dashboard.exists?
$Dashboard.click
@browser.link(:text, "Users").click
@browser.button(:value,"Add New User").click
rows = 8
while rows <= 13
$fname = wrksheet.cells(rows, "A").value
$mname = wrksheet.cells(rows, "B").value
$lname = wrksheet.cells(rows, "C").value
$sss = wrksheet.cells(rows, "D").value
$tin = wrksheet.cells(rows, "E").value
@browser.text_field(:id, $fields[0]).set($fname)
sleep 5
@browser.text_field(:id, $fields[1]).set($mname)
sleep 5
@browser.text_field(:id, $fields[2]).set($lname)
sleep 5
@browser.text_field(:id, $fields[3]).set($sss)
sleep 5
@browser.text_field(:id, $fields[4]).set($tin)
@browser.send_keys :tab
rows += 1
for i in 0..4
if @browser.text_field(:id => $fields[i], :aria_invalid =>
"false")
$number_of_success = $number_of_success + 1
else
$number_of_fails = $number_of_fails + 1
end
end
end
puts "Number of Success: #{$number_of_success}"
puts "Number of Failures: #{$number_of_fails}"
end
end
*The result: *
User1@DOCUMENTATIONS /c/testing
$ ruby revised_login.rb
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
c:/Ruby193/lib/ruby/1.9.1/minitest/autorun.rb:14:in `<top (required)>'
revised_login.rb:2:in `<main>'
MiniTest::Unit.autorun is now Minitest.autorun. From
c:/Ruby193/lib/ruby/1.9.1/m
initest/autorun.rb:18:in `<top (required)>'
MiniTest::Unit::TestCase is now Minitest::Test. From revised_login.rb:5:in
`<mai
n>'
Run options: --seed 13926
# Running:
Number of Success: 30
Number of Failures: 0
.
Finished in 287.038568s, 0.0035 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 0 errors, 0 skips
User1@DOCUMENTATIONS /c/testing
$
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.