简体   繁体   中英

How to get the heading of an alert in selenium webdriver using java?

我能够获取警报的内容,但需要获取警报的标题。

If the alert is of windows then we can get the heading of that alert by using the autoit tool. To do this, download autoit , create the following script and compile it to get an .exe of the script

WinWaitActive('Name of your alert')
$heading= WinGetHandle('Name of your alert')
MsgBox(0,"Hello",$heading,0,0)

In your java code add the following line

Runtime.getRuntime().exec("C:\\Users\\user.abu\\Desktop\\fileUpload1.exe");

where fileUpload is name of your .exe script

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