Forum Discussion

MonicaTeotia's avatar
MonicaTeotia
Occasional Contributor
2 years ago

Unable to Select OK on browser confirmation pop up

Hi,

In my application, when i click on delete button a browser confirmation pop up is displayed with Ok and Cancel buttons however I am not able to select either ok otr cancel options on the pop up.

I used below code

function Confirm_Demo()
{
  var url = "myapplicationurl";
  Browsers.CurrentBrowser.Navigate(url);

  var page = Sys.Browser().Page("*myapplicationname/");
  var link = page.FindElement("//a[contains(text(),'Show Confirm')]");
  link.Click();

  Log.Message("Message text: " + page.Confirm.Message);
  page.Confirm.Button("OK").Click();
}

For me it fails to locate the element ("//a[contains(text(),'Show Confirm'). I am unable to inspect and write the locator for OK button on the pop up.

Please suggest how to locate it

Or is there any other way of handling the confirmation pop up