Java Code Examples for org.openqa.selenium.Alert#getText()
The following examples show how to use
org.openqa.selenium.Alert#getText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RealHtmlElementState.java From ats-framework with Apache License 2.0 | 6 votes |
@PublicAtsApi public boolean isElementPresent() { // with the current Selenium implementation we do not know whether the opened modal dialog // is alert, prompt or confirmation if (element instanceof UiAlert) { return getAlert() != null; } else if (element instanceof UiPrompt) { Alert prompt = getAlert(); return prompt != null && prompt.getText() != null; } else if (element instanceof UiConfirm) { Alert confirm = getAlert(); return confirm != null && confirm.getText() != null; } HtmlNavigator.getInstance().navigateToFrame(webDriver, element); return RealHtmlElementLocator.findElements(element).size() > 0; }
Example 2
Source File: EncapsulateOperation.java From LuckyFrameClient with GNU Affero General Public License v3.0 | 6 votes |
public static String alertOperation(WebDriver wd, String operation) { String result = ""; Alert alert = wd.switchTo().alert(); switch (operation) { case "alertaccept": alert.accept(); result = "�����������ͬ��..."; LogUtil.APP.info(result); break; case "alertdismiss": alert.dismiss(); result = "�����������ȡ��..."; LogUtil.APP.info(result); break; case "alertgettext": result = "��ȡ����ֵ�ǡ�" + alert.getText() + "��"; LogUtil.APP.info("���������ͨ��getText��ȡ����text����...��Text����ֵ:{}��",alert.getText()); break; default: break; } return result; }
Example 3
Source File: ESPublisherNewGlobalPageTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 4
Source File: QAFWebDriverExpectedConditions.java From qaf with MIT License | 5 votes |
public static ExpectedCondition<QAFExtendedWebDriver, Alert> alertPresent() { return new ExpectedCondition<QAFExtendedWebDriver, Alert>() { @Override public Alert apply(QAFExtendedWebDriver driver) { try { Alert alert = driver.switchTo().alert(); alert.getText(); return alert; } catch (NullPointerException e) { } return null; } }; }
Example 5
Source File: WebDriverService.java From cerberus-source with GNU General Public License v3.0 | 5 votes |
@Override public String getAlertText(Session session) { Alert alert = session.getDriver().switchTo().alert(); if (alert != null) { return alert.getText(); } return null; }
Example 6
Source File: ESStoreAssetNewPageTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 7
Source File: ITRenameBucketDuplicate.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 8
Source File: ITCreateBucket.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 9
Source File: ITDeleteSingleBucketCancel.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 10
Source File: ITCreateBucketCancel.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 11
Source File: ITDeleteSingleBucket.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 12
Source File: ITRenameBucket.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 13
Source File: ITCreateDuplicateBucket.java From nifi-registry with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 14
Source File: ESPublisherOverridenGlobalPageTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 15
Source File: ESPublisherAssetCaramelPageTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 16
Source File: ESStoreAddedAssetTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 17
Source File: Step.java From NoraUi with GNU Affero General Public License v3.0 | 5 votes |
/** * @return a String with the message of Alert, return null if no alert message. */ protected String getAlertMessage() { String msg = null; Alert alert = getDriver().switchTo().alert(); if (alert != null) { msg = alert.getText(); alert.accept(); } return msg; }
Example 18
Source File: WebDriverTestCase.java From htmlunit with Apache License 2.0 | 5 votes |
/** * Gets the alerts collected by the driver. * Note: it currently works only if no new page has been loaded in the window * @param maxWaitTime the maximum time to wait to get the alerts (in millis) * @param driver the driver * @param alertsLength the expected length of Alerts * @return the collected alerts * @throws Exception in case of problem */ protected List<String> getCollectedAlerts(final long maxWaitTime, final WebDriver driver, final int alertsLength) throws Exception { final List<String> collectedAlerts = new ArrayList<>(); long maxWait = System.currentTimeMillis() + maxWaitTime; while (collectedAlerts.size() < alertsLength && System.currentTimeMillis() < maxWait) { try { final Alert alert = driver.switchTo().alert(); final String text = alert.getText(); collectedAlerts.add(text); alert.accept(); // handling of alerts requires some time // at least for tests with many alerts we have to take this into account maxWait += 100; if (useRealBrowser()) { if (getBrowserVersion().isIE()) { // alerts for real IE are really slow maxWait += 5000; } } } catch (final NoAlertPresentException e) { Thread.sleep(10); } } return collectedAlerts; }
Example 19
Source File: ESStoreNewGlobalPageTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
Example 20
Source File: ESPublisherAssetOverrideRendererTestCase.java From product-es with Apache License 2.0 | 5 votes |
private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }