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 - Working with Browsers
Watir - Working with Browsers
否则,Watir将在不具体说明浏览器名称的个案中打开。 所需浏览器司机与Watir安装一起安装。 如果你面临与浏览器合作的任何问题,安装浏览器驾驶员一章所示的驾驶员,并更新PATH变量的位置。
在本章中,我们将了解如何打开使用Watir的浏览器。
Steps to Open a Browser using Watir
1. 开放民主选举学会RubyMine,并创建新的档案:测试1.rb
选择K和点击档案格式如下:
Cpck on OK to estabpsh the file.
我们现在将起草一份简单法典,开放浏览器,如下文所示:
test1.rb
require watir Watir::Browser.new
上文所显示的《发展信息网》中强调的《鲁顿》浮标。 在Run的浮标上,它将打开浏览器,如下所示:
浏览器将自动开放和关闭。 现在,让我们在试验1.rb中增加一些法典。
我们可以具体说明如下浏览器的名称:
Example for Chrome
require watir Watir::Browser.new :chrome
现在让我们在我们试验场开一个页。
Example
require watir browser = Watir::Browser.new browser.goto("https://www.google.com")
显示如下产出的Run的浮标:
同样,你可以打开火ox、聋.、互联网探测器浏览器。
Example for Firefox
require watir Watir::Browser.new :firefox
Example for Internet Explorer
require watir browser = Watir::Browser.new :ie browser.goto("https://www.google.com")
在出现错误之后,我们实施守则时——
Unable to find IEDriverServer. Please download the server from (Selenium::WebDriver::Error::WebDriverError) http://selenium-release.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver.
这意味着,轮胎包裹没有互联网供应商司机。 我们从这里下载了同样的内容——
现在再次看到因特网探索者浏览器开张,如下文所示:
Watir code to open Safari Browser
require watir browser = Watir::Browser.new :safari browser.goto("https://www.google.com")
Watir code to Microsoft Edge browser
require watir browser = Watir::Browser.new :edge browser.goto("https://www.google.com")Advertisements