我遇到问题,点击元素并识别名为RadWindowsWrapper
Telerik
的元素(参见下面的捕获),
这是Telerik
弹出窗口,但不是浏览器弹出窗口。
我已多次尝试获取这些元素(单选按钮和文本),但没有成功
以下是一个示例:( f1
元素是Quota Settings
窗口的框架,f2
是子元素)
WebElement f1 = driver.findElement(By.id("RadWindowWrapper_ctl00_RadWindow_QuotaSettings"));
WebElement f2 = f1.findElement(By.xpath("//*[@id='Panel_QuotaSettings']"));
编译器向我发送有关no element was found...
以下是该页面的浏览源:
<form id="form1" action="Users.aspx" method="post">
<div id="RadWindowWrapper_ctl00_RadWindow_QuotaSettings" class="RadWindow RadWindow_Default rwNormalWindow rwTransparentWindow" style="width: 432px; height: 307px; position: absolute; transform: none; backface-visibility: visible; visibility: visible; left: 744px; top: 207px; z-index: 3002;" unselectable="on">
<table class="rwTable" cellspacing="0" cellpadding="0" style="height: 307px;">
<tbody>
<tr class="rwTitleRow">
<tr class="rwContentRow">
<td class="rwCorner rwBodyLeft"> </td>
<td class="rwWindowContent rwExternalContent" valign="top">
<iframe frameborder="0" name="RadWindow_QuotaSettings" src="QuotaSettings.aspx?WindowType=Single&rwndrnd=0.4441132272970014" style="width: 100%; height: 100%; border: 0px none; top: -10000px;" tabindex="0">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html class="RadForm RadForm_Default rfdButton rfdScrollBars rfdZone rfdLabel rfdHeading rfdTextbox rfdTextarea rfdFieldset rfdRadio rfdCheckbox rfdGrids" xmlns="http://www.w3.org/1999/xhtml" style="">
<head id="Head1">
<body style="">
<form id="form1" action="QuotaSettings.aspx?WindowType=Single&rwndrnd=0.4441132272970014" method="post">
<div class="aspNetHidden">
<script type="text/javascript">
<script type="text/javascript" src="/Control/1.1.0.3/WebResource.axd?d=PcHC8Z_NQfDA_cv9GRehCSy-wMODQnJn5RDPjMXn0whea2YnXtTlCc5n52dCBmVTOj7JUYqnQ-a-m583yhJmaNOSB1k1&t=634964064498108000">
<script type="text/javascript" src="/Control/1.1.0.3/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager_QuotaSettings_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a387126a6-cbc0-46b4-b6ca-c8de25a0044f%3aea597d4b%3ab25378d2">
<script type="text/javascript">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/Core.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/jQuery.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Ajax/Ajax.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/FormDecorator/RadFormDecorator.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/Popup/PopupScripts.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/jQueryPlugins.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/TouchScrollExtender.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/Navigation/OData/OData.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Common/Navigation/NavigationScripts.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/ComboBox/RadComboBoxScripts.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Input/TextBox/RadInputScript.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Input/NumericTextBox/RadNumericInputScript.js">
<script type="text/javascript" src="http://aspnet-scripts.telerikstatic.com/ajaxz/2013.1.417/Button/RadButton.js">
<div class="aspNetHidden">
<script type="text/javascript">
<script type="text/javascript">
<div>
<input id="HiddenField_MultyWindowName" type="hidden" name="HiddenField_MultyWindowName">
<table>
<tbody>
<tr>
<td>
<div id="RadAjaxLoadingPanel_QuotaSettings" class="RadAjax RadAjax_Black" style="display:none;">
<div id="Panel_QuotaSettings">
<div id="RadFormDecorator_QuotaSettings" class="RadFormDecorator" style="display:none;">
<table id="Table_QuotaAction">
<tbody>
<tr style="color:Gray;">
<tr>
<td style="white-space: nowrap">
<table>
<tbody>
<tr>
<tr>
<tr>
<td>
<input id="radio_BlockPrinting" class="rfdRealInput" type="radio" onclick="ShowHideQuotaSettings('1');" value="radio_BlockPrinting" name="radio_QuotaAction" _rfddecoratedid="_rfdSkinnedradio_BlockPrinting">
<label id="_rfdSkinnedradio_BlockPrinting" class=" rfdRadioUnchecked" for="radio_BlockPrinting" unselectable="on"> </label>
<span id="Label_BlockPrinting" style="font-size: small;">Block Printing</span>
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
很抱歉,我无法发布图片,我稍后会尝试
BTW - 我试图获得元素id =&#39; radio_BlockPrinting&#39;但正如我所说没有成功,但我试图获得id = RadWindowWrapper_ctl00_RadWindow_QuotaSettings的元素,这是“配额设置”的标题。窗口(Telerik的弹出窗口),那我怎么能得到id =&#39; radio_BlockPrinting&#39; ?任何想法?
答案 0 :(得分:0)
我使用C#遇到了类似的问题。这个解决方案对我有用,希望你能把它翻译成Java:
popUpTrigger.Click();
var handles = driver.WindowHandles;
Console.WriteLine("Handles After Click:");
foreach(var item in handles)
Console.WriteLine(item);
string popupHandle = handles[1];
driver.SwitchTo().Window(popupHandle);