0

I have a problem by clicking on element and recognize the elements named as RadWindowsWrapper of Telerik (see capture below), This is Telerik pop-up window but not browser pop-up window. I have tried several times to get those elements (radio buttons and text) but with no success

Here is an example: (the f1 element is the frame of Quota Settings window, f2 is the sub element)

WebElement f1 = driver.findElement(By.id("RadWindowWrapper_ctl00_RadWindow_QuotaSettings"));
WebElement f2 = f1.findElement(By.xpath("//*[@id='Panel_QuotaSettings']"));

The compiler throw me an error messages about no element was found...

Here is view source of the page:

<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>

Sorry i cant post the image i will try later on

BTW - I have tried to get element id = 'radio_BlockPrinting' but as I said with no success, but i tried to get element with id = RadWindowWrapper_ctl00_RadWindow_QuotaSettings , that this is the title of the 'Quota Setting' window (pop-up window of Telerik), So how can i get id = 'radio_BlockPrinting' ? any idea?

4

1 回答 1

1

我在使用 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);
于 2014-01-22T10:26:12.557 回答