У меня есть веб-приложение, с которым я работаю и создаю средства автоматизации. Я нажал блокировку на определенном шаге, где я нажимаю кнопку, после чего открывается всплывающее окно. В этом всплывающем окне есть только раскрывающийся список и кнопка для отправки.
Кнопка и всплывающее окно:
Мне кажется, что всплывающее окно находится только в разделе div или/или. Я снял фрагмент кода элемента
Код: Выделить всё
{
"Ok": "Ok",
"Cancel": "Cancel"
}
Create Raw Material Mill
{
"BomAddRawMaterialMill": "Create Raw Material Mill",
"BomCopyRawMaterialMill": "Copy Raw Material Mill"
}
Mill Code
ALL - Production locationEAD - EADEAG - EAG
ОК
Отмена
< /div>
Код: Выделить всё
WebElement createRawMatMill = driver.findElement(By.xpath("/html//select[contains(@id,'bom-common-dialogs-copyrawmaterialmilldialogmillcode-combo')]"));
Select rawMaterialMillDD = new Select(createRawMatMill);
createRawMatMill.sendKeys(Keys.ARROW_DOWN);
createRawMatMill.click();
rawMaterialMillDD.selectByIndex(12);
Код: Выделить всё
String mainWindowHandle = driver.getWindowHandle();
Set allWindowHandles = driver.getWindowHandles();
Iterator iterator = allWindowHandles.iterator();
// Here we will check if child window has other child windows and will fetch the heading of the child window
while (iterator.hasNext()) {
String ChildWindow = iterator.next();
if (!mainWindowHandle.equalsIgnoreCase(ChildWindow)) {
driver.switchTo().window(ChildWindow);
WebElement text = driver.findElement(By.id("sampleHeading"));
System.out.println("Heading of child window is " + text.getText());
Источник: https://stackoverflow.com/questions/781 ... te-a-popup