2011-10-27 10 views
0

例を掲載し、 セレンIDEのソリューションがスクリプトを停止することなく「モーダル」ウィンドウで動作するかどうかを知りたいと考えました。私は オンライン例と私が構築されたスクリプトを提供します:詳細は 仕事...Selenium ShowDialogic Modal

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<link rel="selenium.base" 
    href="http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm" /> 
<title>New Test</title> 
</head> 
<body> 
    <table cellpadding="1" cellspacing="1" border="1"> 
     <thead> 
      <tr> 
       <td rowspan="1" colspan="3">New Test</td> 
      </tr> 
     </thead> 
     <tbody> 
      <!--//Open the application and wait to load the combobox--> 
      <tr> 
       <td>open</td> 

       <td>/workshop/samples/author/dhtml/refs/showModalDialog2.htm</td> 
       <td></td> 
      </tr> 
      <tr> 
       <td>waitForElementPresent</td> 

       <td>name=oHeight</td> 
       <td></td> 
      </tr> 
      <!--//Insert height value and click "Push To Create" button--> 
      <tr> 
       <td>select</td> 

       <td>name=oHeight</td> 
       <td>label=250</td> 
      </tr> 
      <tr> 
       <td>click</td> 
       <td>css=input[type=&quot;button&quot;]</td> 
       <td></td> 
      </tr> 
      <!--//Wait for the loading the modal page title and check the text --> 
      <tr> 
       <td>waitForElementPresent</td> 

       <td>//h1</td> 
       <td></td> 
      </tr> 
      <tr> 
       <td>verifyTextPresent</td> 
       <td>This is a modal dialog box. This page is not designed to do 
        anything except display the dialog box arguments.</td> 
       <td></td> 
      </tr> 
      <!--//close the screen and verify that the previous screen is loaded from the height field--> 
      <tr> 
       <td>close</td> 
       <td></td> 

       <td></td> 
      </tr> 
      <tr> 
       <td>selectWindow</td> 
       <td>null</td> 
       <td></td> 
      </tr> 
      <tr> 
       <td>waitForElementPresent</td> 
       <td>name=oHeight</td> 
       <td></td> 
      </tr> 

     </tbody> 
    </table> 
</body> 
</html> 

答えて

0

Webアプリケーションは、実際には、ブラウザのダイアログ(例えば、を除いて、モーダルダイアログを持っていないいません「ファイルを名前で保存...」)、JavaScriptのwindow.alert()window.prompt()、およびwindow.confirm()です。それ以外のものは、別のウィンドウ(従来のWebアプリケーションのように)またはその背後にある要素へのアクセスをブロックするオーバーレイ(現代のAJAXy、Webアプリケーションのように)です。

別ウィンドウの場合、waitForPopUp ...windowname...、次にselectWindow ...windowname...、次にselectWindow(名前なし)を元に戻す必要があります。

オーバーレイの場合、ページ内の他のものと同じようにアドレス指定できますが、要素ロケータが何であるか(またはそうでないかもしれない)、驚くかもしれません。 Firefoxの「XPather」または「Firebug」アドオンを使用して、正しいXPath式を把握してください。

+0

スクリプトを修正して機能させることはできますか? TKS –