[英]How to handle video popup in selenium webdriver c#
我正在尝试自动化视频访问应用程序。 单击“开始通话”链接后,现有/相同的浏览器窗口中会出现一个新的视频弹出窗口。
我正在尝试通过切换到视频弹出窗口(模式窗口)来自动化视频组件,但是切换没有发生
我尝试过切换到窗口,尝试过切换到框架,尝试过警报,但是没有任何效果
HTML代码
<div class="windowframe popup ui-draggable" style="visibility: visible; position: absolute; top: 20px; left: 514px; width: 1000px; z-index: 12; display: block;">
<h2 class="title clearfix ui-draggable-handle">
<span class="p-text">Video Consult</span>
<button class="p-button p-button-close" name="close" tabindex="1">
<div class="p-icon component icon-resolved">
<svg style="" width="512px" height="512px" viewBox="0 0 512 512" version="1.1" id="Layer_1" x="0px"
y="0px">
<path d=""></path>
</svg>
</div>
</button>
<button class="p-button p-button-minimize" name="minimize" tabindex="1" style="display: none;">
<div class="p-icon component icon-resolved">
<svg style="" width="512px" height="512px" viewBox="0 0 512 512" version="1.1" id="Layer_1" x="0px"
y="0px">
<rect width="384" height="64" x="64" y="224"></rect>
</svg>
</div>
</button>
</h2>
<div class="windowcontent" style="height: 396.2px;">
<div control="ViewContainer" class="viewcontainer p-view-viewcontainer control p-view p-view-mode-view p-view-no-toolbar p-view-no-title"
float="" style="height: 100%;"
name="VideoWebRTCView" tabindex="0">
<h2 class="p-container title component hide"><span class="p-text component hide">Video Consult</span>
<div class="busyindicator">
<div class="p-icon component icon-resolved">
<div class="spinner">
<div class="spinner-circle"></div>
</div>
</div>
</div>
</h2>
<div class="p-content content" name="VideoWebRTCView" xmlns:petrel="urn:PetrelXslExtensions" xmlns:bind=" "
xmlns:fx="urn:ExpressionFunctions">
<div control="iFrame" class="iframe p-view-iframe control p-view p-view-mode-view p-view-no-toolbar"
float="" style="height: 366px;" name="Video">
<iframe width="100%" height="100%" scrolling="auto" frameborder="0"
seamless="seamless" src=""></iframe>
</div>
</div>
<div class="metadata"></div>
</div>
</div>
<div class="windowfooter clearfix">
<div class="resize ui-draggable ui-draggable-handle" style="position: absolute;">
</div>
<div class="footerText"></div>
<div class="buttonholder"></div>
</div>
</div>
上面的HTML代码是动态的,单击链接后,上面div标签中的代码将添加到body标签中。
尝试标识以下元素,但抛出noSuchElementException
WebDriver.FindElement(By.XPath("//*[contains(@class,'windowframe')]"));
尝试切换到窗口,但这里的大小始终为1
List<string> listWindow = _context.WebDriver.WindowHandles.ToList();
int size = listWindow.Count;
Console.WriteLine("size: " + size);
foreach (var handle in listWindow)
{
Console.WriteLine("window name: " + handle);
if (!parentwindow.Equals(handle))
{
_context.WebDriver.SwitchTo().Window(handle);
}
}
尝试切换到框架
IWebElement frameele = _context.WebDriver.FindElement(By.Name("Video"));
_context.WebDriver.SwitchTo().Frame(frameele);
windowframe
类的div中,而div不在另一个iframe中,则只需尝试访问div而不更改焦点。
driver.SwitchTo().ActiveElement()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.