惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Affairs
美团技术团队
量子位
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
N
Netflix TechBlog - Medium
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
Recent Announcements
Recent Announcements
Cisco Talos Blog
Cisco Talos Blog
L
LangChain Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 三生石上(FineUI控件)
U
Unit 42
T
Tenable Blog
Security Latest
Security Latest
Scott Helme
Scott Helme
B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
A
Arctic Wolf
S
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
I
Intezer
Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
雷峰网
雷峰网
The Cloudflare Blog
Cloudbric
Cloudbric
Latest news
Latest news
Project Zero
Project Zero
S
Secure Thoughts
V
Visual Studio Blog
博客园 - Franky
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity

博客园 - CrazyCoder

Ubuntu 7.10安装mplayer出现failed to load: drvc.so错误的解决办法 QueryString中的加号不见了 Google Docs Presentation is live now! 你是哪种类型的程序员? 在团队中建立领导能力 国内Ruby On Rails最新动态 framework vs. library learning MVC Top 6 List of Programming Top 10 Lists Reflector 5 Released LINQ/C# Learning Guide - via TheServerSide ProgrammingBooks.org first work day of 2007, first work day in new company 2006年的最后一天,以及2007,我最Google的期望 一些安装VS2005 SP1的技巧 下一版VS.NET的一些新功能 [读书笔记]软件开发中,人和过程的关系 Windows Vista SDK released ideaWins,微软推出了免费的Office Accounting 2007 Express
handling popup window in Watir
CrazyCoder · 2007-04-17 · via 博客园 - CrazyCoder

Handling popup window in testing browser based applications is always an annoying problem. Watir provides a good solution for this, here is what I learned from the Watir mail list and share it here to everyone else.

You will need newest Watir (build late than 1.5.1.1079) to do it.

Here is the ruby scripts to handle popup windows:  

#includes
require 'watir'   # the controller
require 'watir\contrib\enabled_popup'
include Watir

#test::unit includes
require 'test/unit'

class TC_dimensionnet_login < Test::Unit::TestCase

  def test_window_popup
 
    testSite = "http://localhost/test.htm"
   
    $ie = Watir::IE.new
   
    $ie.goto(testSite)
   
    $ie.button(:id,"btnPopup").click
    startClicker("OK", 5)
  end
 
  # function click buttons on a popup window
  def startClicker( button , waitTime=9, user_input=nil )

     hwnd = $ie.enabled_popup(waitTime)  # get a handle if one exists
    
     if (hwnd)  # yes there is a popup
     puts hwnd
       w = WinClicker.new

       if ( user_input )
         w.setTextValueForFileNameField( hwnd, "#{user_input}" )
       end

       sleep 3  # I put this in to see the text being input it is not necessary to work
       w.clickWindowsButton_hwnd( hwnd, "#{button}" )  # "OK" or whatever the name on the button is
       w=nil    # this is just cleanup

     end

   end
  
end


Powered by ScribeFire.