简体   繁体   English

弹出消息以硒显示几秒钟

[英]Pop up message to display for few seconds in selenium

I am running a selenium script using Java. 我正在使用Java运行硒脚本。 The functionality of the code is to open a Google web page and exit the browser. 该代码的功能是打开Goog​​le网页并退出浏览器。 After exiting the browser i need a pop up message to be displayed saying "Code executed" and fade away in couple of seconds. 退出浏览器后,我需要显示一条弹出消息,提示“代码已执行”,并在几秒钟后消失。 I believe there is an way to display a message either by using JQuery or Javascript but i do not know how to inject that JQuery/Javascript method into my script. 我相信可以使用JQuery或Javascript显示消息,但是我不知道如何将JQuery / Javascript方法注入到脚本中。 Here's my code: 这是我的代码:

public class test1 { 公共课程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
    }
}

Add this line where ever you want to display the popup box. 将此行添加到要显示弹出框的位置。

JOptionPane.showMessageDialog(frame,"Welcome please look in to the process");

plese go through https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html 请浏览https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

Regards, 问候,

BK BK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM