【发布时间】:2016-10-07 23:44:12
【问题描述】:
我有一个 iframe,然后是一个包含创建发票按钮的小部件。它不在 iframe 内部,而是在 iframe 外部,我无法访问它。我无法使用 selenium webdriver java 访问此对话框,我正在尝试使用 java 访问创建发票按钮:
</div><div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"><div class="ui-dialog-buttonset"><button type="button" id="saveBtnDialog" class="btn btn--primary">Create Invoice</button><button type="button" id="CancelBtnDialog" class="btn btn--primary">Cancel</button></div></div></div>
我的代码:
private final By createInvoiceBtn = By.id("saveBtnDialog");
driver.switchTo().frame(driver.findElement(By.cssSelector(".ui-dialog-buttonset")));
driver.findelement(createInvoiceBtn).click();
【问题讨论】:
-
你能分享你的java代码吗?你做了什么。
-
我将它添加到顶部有什么想法可以做什么?
标签: java selenium-webdriver automation selenium-chromedriver