# Ruby Script for dealing with pop
require "watir"
require "logger"
require 'net/smtp'
require 'win32ole'
require 'watir/dialog'
require 'watir/ie'
require 'watir/contrib/enabled_popup'
require 'watir/WindowHelper'
require 'watir/winClicker'
# set a variable
test_site = "C:\\test.html"
# open the IE browser
ie = Watir::IE.new
#ie.maximize
ie.goto test_site
def startClicker( button , waitTime = 0.2)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb
#{button }
#{ waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
# starting the clicker
startClicker("OK")
#clicking the link which leads to pop up
ie.link(:test,"Click Here").click
##Testing the below HTML code:
<html><head><script type="text/javascript">
function disp_alert()
{
alert("I am an alert box!!");
}
</script></head><body>
<a href= "http://www.google.com" onclick="disp_alert()" /> Click Here
</a>
</body></html>
Instead of http://www.google.com I am getting the following error
please help me with this....
>ruby testhtml.rb
testhtml.rb:22:in `startClicker': undefined method `dir' for
nil:NilClass (NoMethodError)
from testhtml.rb:33
>Exit code: 1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---