我想单击一个小工具提示大小的对话框,其中包含内容“删除关联”。我有以下脚本:
strMenu_Body = menu.document.body;
strMenu_Body.style.backgroundColor = "#EFF6FD";
var strMenu_Text = "<TABLE Align=Center width=100% height=100% CellPadding=0 CellSpacing=0 Border=1 BorderColor=#A5BACE style=font-family:arial;font-size:12px;color:black;>"
if (type != "Flag") {
if (val.indexOf('s10001') > 0) {
if (document.all(val).iComponentType) {
if (document.all(val).iComponentType == "Recall")
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD align=center> <Font ID=RemoveAssociation onClick=parent.callParent('" + val + "','DELETE_ASSOCIATION') style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Delete Recall</Font></TD></TR>"
else
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD align=center> <Font ID=RemoveAssociation onClick=parent.callParent('" + val + "','DELETE_ASSOCIATION') style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Cancel Appointment</Font></TD></TR>"
}
else
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD align=center> <Font ID=RemoveAssociation onClick=parent.callParent('" + val + "','DELETE_ASSOCIATION') style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Delete Recall</Font></TD></TR>";
}
else if (val.indexOf('s20002') > 0) {
if (document.all("btn~~PatEducations20002").all("Comp_Heading").innerHTML.length > 20)
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD> <Font ID=RemoveAssociation onClick=parent.removePatientEducation(0); style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Remove Flag</Font></TD></TR>"
else
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD align=center> <Font ID=RemoveAssociation onClick=parent.removePatientEducation(1); style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Remove Association</Font></TD></TR>"
}
else
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD> <Font ID=RemoveAssociation onClick=parent.callParent('" + val + "','DELETE_ASSOCIATION') style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Remove Association</Font></TD></TR>"
}
else
strMenu_Text = strMenu_Text + "<TR HEIGHT=20 ID=traSch1 ><TD> <Font ID=RemoveAssociation onClick=parent.callParent('" + val + "','DELETE_FLAG_ASSOCIATION') style=cursor:hand onmouseover=javascript:this.style.color='red'; onmouseout=javascript:this.style.color='black';>Remove Flag</Font></TD></TR>"
strMenu_Text = strMenu_Text + "</TABLE>"
strMenu_Body.innerHTML = strMenu_Text
menu.show(intMenu_X, intMenu_Y, intMenu_Width, intMenu_Height, document.all("cmbFontName"))
}
`
我不知道如何单击该对话框。请帮助。我正在使用Java,Selenium,IE 10,Win 8。
还请告诉我如何单击属性为“ onclick”的元素,例如onClick=parent.callParent('" + val + "','DELETE_ASSOCIATION')
。非常感谢
您可以使用一些javascript注入魔术,请尝试以下操作:
WebElement element = driver.findElement(By.xpath("//*[contains(text(),'Remove Association')]"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", element);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句