Java – Click to confirm the modal dialog with selenium webdriver

I have a modal dialog like this:

I want to click OK to save this text So I use switchto switch to this dialog box:

webDriver.switchTo().frame(0);

I assume that because there is only one dialog, I use frameid = 0 But I don't know how to move on from here or how to click the OK button, because I didn't get any HTML information

Any help many appusicated

Solution

It doesn't look like a frame If it's a frame, you can use these buttons So can you check those buttons? If not, it is an alert wrapped in JavaScript Use the switch to remind here

Alert alert = driver.switchTo().alert();
    alert.accept(); // for OK

Thank you, Mulally

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>