我正在使用Java运行selenium脚本。代码的功能是打开Google网页并退出浏览器。 退出浏览器后,我需要显示一条弹出消息,说明"代码已执行"并在几秒钟内逐渐消失。 我相信有一种方法可以通过使用JQuery或Javascript来显示消息,但我不知道如何将JQuery / Javascript方法注入到我的脚本中。 这是我的代码:
public class test1 {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.get("http://google.com");
driver.quit();
//I need a method here to display a pop up msg and fade away
}
}
答案 0 :(得分:0)
将此行添加到要显示弹出框的位置。
JOptionPane.showMessageDialog(frame,"Welcome please look in to the process");
请仔细阅读https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
此致
BK