Я хочу обработать это всплывающее окно и нажать кнопку «Отмена». Я пытался, но это не кликабельно
Изображение для всплывающего окна
![Image For Popup](https://i.stack.imgur.com/7P8Po.jpg)
Я также добавил HTML-изображение, пожалуйста, проверьте и сообщите мне решение
Изображение для HTML-кода
![Image For HTML Code](https://i.stack.imgur.com/lBPi2.jpg)
Тестовый сценарий проходит в Selenium, но он не щелкает. Да, я тоже буду прикреплять Selenium Code.
package Backendsite;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
public class SkipTest {
@Test
public void f()
{
System.setProperty("webdriver.chrome.driver", "F:\\New folder\\chromedriver.exe");
//Setting To Open Incoginoto Window
ChromeOptions options = new ChromeOptions();
options.addArguments("-incognito");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver chromedriver=new ChromeDriver(capabilities);
chromedriver.manage().window().maximize();
//Opening The WebSite
chromedriver.get("xxxxxxxxxxxxxxxx");
chromedriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
Pomsite p1 = PageFactory.initElements(chromedriver, Pomsite.class);
Select s1 = new Select(p1.getE1());
s1.selectByVisibleText("xxxxxxxxxx");
p1.getE2().click();
try
{
Actions a1 = new Actions(chromedriver);
a1.moveToElement(p1.getE3()).click(p1.getE4()).build().perform();
}
catch(Exception e)
{
System.out.println("Can't Click");
}
chromedriver.close();
}
}
Мой второй код для класса модели Pageobject:
package Backendsite;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class Pomsite
{
public WebElement getE1() {
return e1;
}
public WebElement getE2() {
return e2;
}
public WebElement getE3() {
return e3;
}
public WebElement getE4() {
return e4;
}
@FindBy(id="ddlstore")
private WebElement e1;
@FindBy(xpath="//input[@id='CustomPaging_GridView_gv_edit1_0']")
private WebElement e2;
@FindBy(xpath="/html/body/div[1]/div/div/div[3]")
private WebElement e3;
@FindBy(xpath="/html/body/div[1]/div/div/div[3]/button[2]")
private WebElement e4;
}
Мой HTML-код для всплывающей кнопки «Отмена»
<div class="modal-footer">
<span id="prcid" style="display:none;">processing...</span>
<button type="button" id="skipok" onclick="skipoverall(this)" class="btn btn-primary" data-id="10514438996">Ok</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
PS: я также пробовал всплывающее окно оповещения и подтверждения, оно не работает.