I need to create a method in c # so that the selenium webdriver according to the test accepts the popup button on the web since in the first test it does not show the popup but in the rest of the executions yes.
For what I need if you show the popup I accept it with a click, but if you show it I continue with the following method.
public void ComprobarPopup() {
List<WebElement> popup ; popup =
WebDriver.FindElement(By.XPath("//div[@id='popup']/div/h1"));
if(elements.size()!=0)
this._aceptarPopup.Click();
else {
//necesito que siga con el siguiente metodo
}
Could you help me? Thanks