RE: Modal control

Answered

I have a Delete button that I click. When I do I get a modal popup with “Are you sure?”  followed by Ok /  Cancel  controls. I Can select the initial Delete but not sure how to select ‘Ok’ on the modal popup.

<input value=”Delete” class=”btn” title=”Delete” name=”delete” onclick=”if ((Modal.confirm &amp;&amp; Modal.confirm(‘Are you sure?’)) || (!Modal.confirm &amp;&amp; window.confirm(‘Are you sure?’))) navigateToUrl(‘/setup/own/deleteredirect.jsp?srKp=001&amp;srPos=0&amp;delID=00119000003kBGD&amp;retURL=%2F001%2Fo&amp;_CONFIRMATIONTOKEN=pV2MttmnuVookU9jJgi5t6V.WYdoUYfTke7RG_aoWvkb8gtqliYmmBdMpwqagqSYvTCpWm5B5FJzBf.5VDgvI6dE4AxSEQyIVpYf.fPXH8nfqzQq3f9FDmZU23VNIJ1lJ911a1ANwOXYfT27mOze5DS9Hvs%3D&amp;failRetURL=%2F00119000003kBGD%3FsrPos%3D0%26srKp%3D001′,’DETAIL’,’delete’);” type=”button”>

Add Comment
4 Answers
Best answer

Hello Allen,

Try below code, this may help you.

// Get a handle to the open alert, prompt or confirmation


Alert alert = driver.switchTo().alert();

//Will Click on OK button.


alert.accept();

// Will click on Cancel button.


alert.dismiss()

Vice Professor Answered on October 5, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.