- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想关闭这个弹出窗口。它不是警报,不在框架中,也不是窗口。我可以关闭它的 Robot
类,但 PM 说在这种情况下使用 Robot
类不是正确的做法。
那么我该如何关闭它呢?
我尝试了很多次,但没有成功。
查看图片:-
HTML:
<div id="yui_patched_v3_11_0_1_1473662523684_188" class="page-popup-container-content modal-content yui3-widget-stdmod yui3-widget-content-expanded">
<div id="yui_patched_v3_11_0_1_1473662523684_365" class="yui3-widget-hd modal-header">
<div id="yui_patched_v3_11_0_1_1473662523684_293" class="toolbar-content yui3-widget component toolbar">
<button id="yui_patched_v3_11_0_1_1473662523684_367" class="btn close close-content yui3-widget btn-content btn-focused" type="button">×</button>
</div>
<h3 id="yui_patched_v3_11_0_1_1473662523684_366">Security Tips</h3>
</div>
<div id="yui_patched_v3_11_0_1_1473662523684_344" class="yui3-widget-bd modal-body" style="max-height: 450px; height: 365px;">
<div id="yui_patched_v3_11_0_1_1473662523684_501" class="pop-contain">
<div id="yui_patched_v3_11_0_1_1473662523684_527" style="text-align: center; margin-top: 1em;">
<button id="yui_patched_v3_11_0_1_1473662523684_526" class="lgnBtn btn btnPrimary" type="button" onclick="closepopup1();">Close</button>
尝试使用selenium
编写代码:-
WebDriver driver; driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("brcp.infoaxon.com");
String currentHandle = driver.getWindowHandle(); driver.findElement(By.xpath(".//div[1]/a")).click();
Thread.sleep(1000);
Set<String> handles = driver.getWindowHandles();
for (String handle : handles)
{
if (!handle .equals(currentHandle))
{
driver.switchTo().window(handle);
driver.close();
}
driver.switchTo().window(currentHandle);
}
最佳答案
实际上这不是一个新的窗口弹出,它是一个对话框窗口,点击Read More
按钮后会弹出,您应该在点击Read More
按钮后使用WebDriverWait
尝试使用By.cssSelector()
找到close
按钮,等待该元素可见并可点击,如下所示:-
WebDriverWait wait = new WebDriverWait(driver, 10);
//Click on read more button to open this dialog
wait.until(ExpectedConditions.elementToBeClickable(By.partialLinkText("Read More"))).click();
//Now wait until this dialog close button visible and clickable then click
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("button.btn.close"))).click();
关于java - 如何关闭出现在同一页面上的子弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39445036/
是否可以用按钮替换 ul 元素符号?我知道您可以使用 CSS 更改为图像,但如果我想要一个实际的元素呢? 最佳答案 这不可能如您所问,但您也许可以效仿它: some button textL
我在让元素符号显示在无序列表中时遇到了一些问题。如果我更改 css 以在内部显示元素符号,它们应该向上,但紧挨着文本。我的伙伴想要的是元素符号显示在框架的最左侧,并且在它和文本之间有几个标签值的空间。
我正在使用 the Orbit component of Foundation 5并想知道是否有办法将出现在幻灯片下方的元素符号移动到幻灯片本身的内容区域中。基本上,将元素符号放在图片上方。 有很多
我有一个从 wordpress 帖子生成的 ul li 边栏。客户为每个 LI 的元素符号使用了不同的图像。与其手动添加单独的元素符号,不如从一组(比如说 10 个)选项中进行选择? 正在考虑 Jqu
我有一个带有方向键和 2 个按钮的游戏 handle 。所有这些都是数字的(不是模拟的)。 我有一个处理他们的事件的程序: -(void)gamepadTick:(float)delta {
稍微注释掉后,我发现当我在 JavaScript 中运行此命令时,我的无序列表中的元素符号消失了(每个“页面”都是我的无序列表中的一个元素。): pages[i].style.display = "b
假设我想存储所有子弹,任何人在我的游戏中射击以计算每帧的新位置等。 如果有 10 名玩家,并且每个人的射击速率为每秒 10 次射击,我们可能需要在 10 秒后跟踪 1000 个物体。 我们确实知道,数
这是我所拥有的: import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt
我正在通过 ant-design (antd) 库开发一个 reactjs 元素。我想在我的元素中使用 Carousel 组件。当我将内容的背景色 - 应显示在轮播内 - 设置为#FFF 时,元素符号
我是一名优秀的程序员,十分优秀!