简体   繁体   中英

Creating alert messages in Selenium javascript

Could you please share if we can create a pop alert saying Activity Begins and once the execution of specific scripts ends another pop alert saying Activity Completed.

I tried Windows.alert which does not work. Also I have gone through most of the post all are related to handling of pop-ups not related to creation.

Just try the below one, which gives popup with "HI.." message (example in Java):

JavascriptExecutor jse=(JavascriptExecutor)driver;
jse.executeScript("window.confirm('HI..');");

Only thing is you need to use JavascriptExecutor to execute javascript which creates an alert popup. Make sure you need to handle this also in automation if required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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