Watir Tutorial
Selected Reading
- Watir - Discussion
- Watir - Useful Resources
- Watir - Quick Guide
- Watir - Browser Windows
- Watir - Downloads
- Watir - Alerts
- Watir - Proxies
- Watir - Cookies
- Watir - Page Performance
- Watir - Page Objects
- Watir - Capturing Screenshots
- Watir - Mobile Testing
- Watir - Headless Testing
- Watir - Automatic Waits
- Watir - Working with Iframes
- Watir - Locating Web Elements
- Watir - Web Elements
- Watir - Working with Browsers
- Watir - Installing Drivers for Browsers
- Watir - Environment Setup
- Watir - Introduction
- Watir - Overview
- Watir - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Watir - Alerts
Watir - Alerts
在本章中,我们将了解如何处理使用Watir的警报。
Syntax
browser.alert.exists? browser.alert.ok browser.alert.close
Testpage
<html> <head> <title>Testing Alerts Using Watir</title> </head> <body> <script type = "text/javascript"> function wsformsubmitted() { alert("Button is Cpcked !"); } </script> <button id = "btnsubmit" oncpck = "wsformsubmitted();">Submit</button> </body> </html>
Watir Code
require watir b = Watir::Browser.new :chrome b.goto( http://localhost/uitesting/testalert.html ) b.button(id: btnsubmit ).cpck b.alert.ok b.screenshot.save alerttest.png
产出警戒测试。 页: 1
Advertisements