[wtr-general] Re: Unexpected output..

2015-02-20 Thread Chuck van der Linden
On Thursday, February 19, 2015 at 10:50:18 PM UTC-8, Ping-0t wrote:

 Hello Guys,

 Again I am having trouble about my testing? I got this warnings in the 
 inspect element console when I try to execute my codes [below].

 Use of getPreventDefault() is deprecated.  Use defaultPrevented instead. 
 jquery.min.js:3
 Use of getAttributeNode() is deprecated. Use getAttribute() instead.
 Security wrapper denied access to property length on privileged Javascript 
 object. Support for exposing privileged objects to untrusted content via 
 __exposedProps__ is being gradually removed - use WebIDL bindings or 
 Components.utils.cloneInto instead. Note that only the first denied 
 property access from a given global object will be reported.

 My codes:


Those sort of things appearing in the developer tools console are usually 
coming from javascript code within the web pages of your site.  You should 
report them to your developers, but you need to be sure what page you were 
on, or what actions resulted in seeing the errors.

Warnings I would generally just ask someone if they know or care about 
them.  often they already know

Any actual errors there should be reported, they usually represent a 
problem with their code, or how they are using a standard library like 
jquery 


 Then after the execution I got this kind of output: 

 E
 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
 ...


The first bit of that is  telling you that they way to require minitest has 
changed and you need to update your code.  there is likely something about 
it on the main site (often a github page) for minitest.   I don't use 
minitest so I can't give you more details than that.  

But likely you are basing what you have for minitest on some blog or site 
that is now out of date due to changes in minitest.  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Unexpected output..

2015-02-20 Thread Ping-0t
Hi sir, I change my codes into this:

require 'watir-webdriver'

gem test-unit
require 'test/unit'
require win32ole

class Login  Test::Unit::TestCase

$number_of_fails = 0
$number_of_success = 0

$fields = [first_name, middle_name, last_name, sss_number, 
tin_number]

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


#  Authentication / Login Part ---
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

# - Before Adding a new User
$Dashboard = @browser.link(:text, Dashboard)
$Dashboard.exists?
$Dashboard.click
@browser.link(:text, Users).click
@browser.button(:value,Add New User).click


#  Add new User 
# Personal Information Block
# @browser.send_keys :f12
rows = 8
while rows = 13
$to_enter = [wrksheet.cells(rows, A).value, wrksheet.cells(
rows, B).value, wrksheet.cells(rows, C).value, wrksheet.cells(rows, D
).value, wrksheet.cells(rows, E).value]

@browser.text_field(:id, $fields[0]).set($to_enter[0])
sleep 5
@browser.text_field(:id, $fields[1]).set($to_enter[1])
sleep 5
@browser.text_field(:id, $fields[2]).set($to_enter[2])
sleep 5
@browser.text_field(:id, $fields[3]).set($to_enter[3])
sleep 5
@browser.text_field(:id, $fields[4]).set($to_enter[4])
@browser.send_keys :tab

rows += 1

(0..4).each do |i|
if @browser.text_field(:id = $fields[i], :aria_invalid = 
true).exist?
$number_of_success = $number_of_success + 1
puts @browser.execute_script('return 
document.getElementsByClassName(form-control)[0];')
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

And then I have this output: 


User1@DOCUMENTATIONS /c/testing
$ ruby revised_login.rb
Loaded suite revised_login
Started
#Watir::Input:0x349e888
#Watir::Input:0x1e2bfe0
#Watir::Input:0x257c538
#Watir::Input:0x282ad88
#Watir::Input:0x28f77f0
#Watir::Input:0x341b3b0
#Watir::Input:0x346f500
#Watir::Input:0x348ba60
#Watir::Input:0x2469ab0
#Watir::Input:0x2818488
#Watir::Input:0x28d6c58
#Watir::Input:0x27dfd28
#Watir::Input:0x341a978
#Watir::Input:0x3495bd0
#Watir::Input:0x34ad600
#Watir::Input:0x245f910
#Watir::Input:0x28090f8
#Watir::Input:0x28d32f8
#Watir::Input:0x3411768
#Watir::Input:0x3448020
#Watir::Input:0x3473ce8
#Watir::Input:0x3499890
#Watir::Input:0x34ca298
Number of Success: 23
Number of Failures: 7
.

Finished in 310.804865 seconds.


1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 
notifica
tions
100% passed


0.00 tests/s, 0.00 assertions/s

User1@DOCUMENTATIONS /c/testing
$

Sir, I don't really understand the output. But when I will change my codes 
from
puts @browser.execute_script('return 
document.getElementsByClassName(form-control)[0];')

into
puts @browser.execute_script('return 
document.getElementsByClassName(form-control)[0];').html
I have this error:


User1@DOCUMENTATIONS /c/testing
$ ruby revised_login.rb
Loaded suite revised_login
Started
E


Error: test_in(Login)
: Selenium::WebDriver::Error::JavascriptError: invalid 'in' operand a
[remote server] http://gw01.nextix.org/user/ line 68  Function:18:in `G'
[remote server] http://gw01.nextix.org/user/ line 68  Function:18:in 
`anonymous
//'
[remote server] http://gw01.nextix.org/user/ line 68  Function:15:in 
`anonymous
/'
[remote server] http://gw01.nextix.org/user/ line 68  Function:15:in 
`anonymous
'
[remote server] http://gw01.nextix.org/user/:68:in `handleEvaluateEvent'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/
webdr
iver/remote/response.rb:52:in `assert_ok'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdr