English 中文(简体)
Watir - Browser Windows
  • 时间:2024-03-18 22:22:13

Watir - Browser Windows


Previous Page Next Page  

你们将走到我们必须使用人口窗口或打开新的浏览器窗户的地方。 在本章中,我们将讨论如何利用Watir测试此类案件。

Syntax

browser.window

这里提供了我们将测试的一个工作例子:

<html>
   <head>
      <title>Testing UI using Watir</title>
   </head>
   
   <body>
      <script type = "text/javascript">
         function wscpck() {
            var myWindow = window.open(
               "https://www.google.com/", "mywindow", "width = 1000,height = 500");
         }
      </script>
      
      <form name = "myform" method = "POST">
         <span>
            <br>
            <input type = "button" id = "btnsubmit" name = "btnsubmit" value = "submit" oncpck = "wscpck()"/>
            <br>
         </span>
      </form>
      <br/>
   </body>
</html>

Output

Browser Windows

猪顿开放窗口的浮点打开。 这里,我们提供的尿液是 require watir b = Watir::Browser.new :chrome b.goto( http://localhost/uitesting/windowpopup.html ) b.button(id: btnsubmit ).cpck b.window(title: Google ).use do b.screenshot.save popupwindow.png t = b.text_field(class: gLFyf ) t.set Watir b.screenshot.save popupwindowbefore.png b.button(name: btnK ).cpck b.screenshot.save popupwindowafter.png end

我们的屏幕如下:

popupwindow.png

Working With Links Outputs

popupwindowbefore.png

Popupwindowbefore

popupwindowafter.png

Popupwindowafter

Advertisements