We started test automation on our web app (ASP.NET). We should've done it ages ago and the meantime the app has become complex so our Selenium progress is very slow. I'm completely new to Selenium and I have a situation, well, right from the start. Our app, upon clicking a button on the main form opens a dialog.
This how it looks like in the inspect element:
<div id="ModalPopupControl_PW-1" class="dxpcLite dxpclW dxpc-mainDiv dxpc-shadow" style="width: 975px; cursor: default; z-index: 12000; visibility: visible; display: table; position: absolute; height: 713px; left: 132px; top: 66px;">
<div class="dxpc-header dxpc-withBtn" style="cursor:move;-khtml-user-select:none;" id="ModalPopupControl_PWH-1">
<div class="dxpc-closeBtn" id="ModalPopupControl_HCB-1">
<img class="dxWeb_pcCloseButton" src="/Client/DXR.axd?r=1_37-WyBvg" alt="[Close]">
</div>
<div class="dxpc-headerContent" style="padding-left: 0px !important; padding-right: 18px !important; line-height: 10px; height: 14px;">
<span class="dxpc-headerText dx-vam" id="ModalPopupControl_PWH-1T"></span>
</div>
<b class="dx-clear">
</b>
</div>
<div class="dxpc-contentWrapper" style="display: table; height: 692px;">
<div class="dxpc-content" style="padding: 0px; display: block; height: 692px;" id="ModalPopupControl_PWC-1">
<iframe id="ModalPopupControl_CIF-1" scrolling="auto" frameborder="0" src="Controls/NewDoc/NewDocumentPage.aspx" style="width: 100%; height: 100%; overflow: auto; backface-visibility: hidden; vertical-align: text-bottom;"> </iframe>
</div>
</div>
</div>
So, it's div, with an iframe in it.
I can select the dialog using an CssSelector, but no matter what the element WITHIN new pop-up dialog - I can't reach it using selenium.
My attempt to get it is pretty straightforward:
Driver.chrome.FindElement(By.CssSelector("#newDocumentControl_CallbackPanelShowGrids_rbSelection_RB1_I_D")).Click();
Error I get is:
{"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"#newDocumentControl_btnCancel\"}\n (Session info: chrome=71.0.3578.98)\n (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.17134 x86_64)"}
I've tried SwitchTo().Alert
, MoveTo element, searching by z index...
I'm using Chrome, Visual Studio 2017 and C#.
I could really, really use some tips...