Selenium Webdriver - (Java) - 使用HTML对话框 [英] Selenium Webdriver - (Java) - working with HTML dialogs

查看:178
本文介绍了Selenium Webdriver - (Java) - 使用HTML对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是这种情况:


  1. 点击导入文件按钮动作会上传文件)。

  2. 文件上传后,会弹出一个弹出窗口(HTML弹出窗口)。我使用 driver.switchTo()。frame(1); 切换到该弹出窗口,然后单击该弹出窗口中的下一步。

  3. 点击下一步将导航用户到该弹出窗口的第二步。在弹出窗口的第二步中点击进程佣金按钮。

  4. 点击进程佣金按钮后,会出现一个新的确认弹出窗口(HTML弹出窗口)。

  5. 我无法在该确认弹出窗口中单击

  1. Click on Import file button (this action will upload a file).
  2. After file upload, then appears a popup (HTML popup). I used driver.switchTo().frame(1); to switch to that popup and click "Next" in that popup.
  3. Clicking Next will navigate user to second step in that popup. Click process commission button in that second step of popup.
  4. After clicking process commission button, then appears a new confirmation popup (HTML popup).
  5. I am not able to click yes in that confirmation popup.

我尝试使用:

driver.switchTo()。frame(0) ; - 没有工作

driver.switchTo()。frame(1); - 没有工作

driver.switchTo()。frame(2); - 没有工作

I tried using:
driver.switchTo().frame(0); - did not work
driver.switchTo().frame(1); - did not work
driver.switchTo().frame(2); - did not work

请建议任何解。

<form id="Form1" enctype="multipart/form-data" action="ProcessCommission.aspx?i=2115&pn=Manage+Commission&j=2345&prn=Process+Commission" method="post">
<iframe scrolling="no" frameborder="0" src="javascript:'<html></html>';" style="position: fixed; width: 400px; height: 100px; left: 431px; top: 53px; background-color: rgb(255, 255, 255); z-index: 3003;" tabindex="-1">  
<div id="RadWindowWrapper_confirm1381733327500" class="RadWindow RadWindow_Windows7 rwNormalWindow rwTransparentWindow" style="width: 400px; height: 100px; position: absolute; transform: none; backface-visibility: visible; visibility: visible; left: 431px; top: 377px; z-index: 3003;" unselectable="on">  
<table class="rwTable" cellspacing="0" cellpadding="0" style="height: 51px;">  
<tbody>  
<tr class="rwTitleRow">  
<tr class="rwContentRow">  
<td class="rwCorner rwBodyLeft"> </td>
<td class="rwWindowContent" valign="top">  
<iframe frameborder="0" name="confirm1381733327500" src="javascript:'<html></html>';" style="width: 100%; height: 100%; border: 0px none; display: none;" tabindex="0">  
<div id="confirm1381733327500_content">  
<div class="rwDialogPopup">  
<div class="rwDialogText">  
<div>
<a class="rwPopupButton" href="javascript:void(0); "onclick="$find('confirm1381733327500').close(true);" tabindex="-1">
<span class="rwOuterSpan">  
<span class="rwInnerSpan">Yes</span>  
</span>
</a>  
<a class="rwPopupButton" href="javascript:void(0);" onclick="$find('confirm1381733327500').close(false);" tabindex="-1">  
<span class="rwOuterSpan">  
<span class="rwInnerSpan">No</span>  
</span>


推荐答案

尝试这个:

driver.switchto.frame(0)
driver.switchto.frame(confirm1381733327500)

这篇关于Selenium Webdriver - (Java) - 使用HTML对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆