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 Answer(s)
    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

    Do I need to wrap that code in something be formatted better?

    Train Answered on October 3, 2014.

    There is <> in the edit box where you type in your questions. Thats the code block which will format the code.

    HTML of the modal control might help in giving you the answer.

    Thanks
    Virender

    on October 4, 2014.
    Add Comment

    Wow,  ok. So how did you know that? Experience in Java .. Selenium?

    Train Answered on October 6, 2014.

    If the above question is about to my answer then – These are the basics of selenium.Or is to “Virender” then he will reply to your question.

    on October 6, 2014.
    Add Comment

    SACHIN

    Ok. Apparently I don’t even know the basics. :-).  Usually I can look at the underlying code to see what to use to navigate the app or get close to it. but this one I had no clue. Anyway, thanks. I need to study a lot more it sounds like.

    Train Answered on October 6, 2014.

    Please don’t mind Allen, my intention was not like that (you don’t know basics). Sorry if i presented wrongly.

    on October 6, 2014.
    Add Comment
  • Your Answer

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