List of usage examples for org.openqa.selenium WebElement getText
String getText();
From source file:com.citrix.g2w.webdriver.pages.recordings.MyRecordingsPage.java
License:Open Source License
/** * Get the number of views for a recording * * @param recordingId Recording Id//from ww w .j a va 2 s . co m * @return Number of views */ public int getNumberOfViews(String recordingId) { WebElement recordingViewsLink = this.driver .findElement(By.xpath("//ul[@class='table-data-row']/li/a[contains(@href,'" + recordingId + "')]")); return Integer.parseInt(recordingViewsLink.getText()); }
From source file:com.citrix.g2w.webdriver.pages.recordings.RegisterForRecordingPage.java
License:Open Source License
public List<String> getErrorMessages() { List<String> fieldErrorMessagesList = new ArrayList<String>(); for (WebElement element : errorMessages) { fieldErrorMessagesList.add(element.getText()); }/*www .java 2 s .c o m*/ return fieldErrorMessagesList; }
From source file:com.citrix.g2w.webdriver.pages.registration.RegistrationConfirmationPage.java
License:Open Source License
/** * Method to get Sequence Webinar Times occurrence. * /*from w ww .j a v a 2 s .c om*/ * @return */ public List<String> getRecurringWebinarTimesList() { List<String> webinarTimeStrs = new ArrayList<String>(); for (WebElement webinarTime : recurringWebinarTimesList) { webinarTimeStrs.add(webinarTime.getText().trim()); } return webinarTimeStrs; }
From source file:com.citrix.g2w.webdriver.pages.registration.RegistrationPage.java
License:Open Source License
/** * Method to return all optional questions as list. * //w w w . j a va 2 s.c o m * @return (optional question label name list) */ public List<String> getOptionalQuestions() { List<String> optionalQuestionLableNameList = new ArrayList<String>(); try { List<String> requiredFieldsList = Arrays.asList( new String[] { "//div[@id='studentInformation']//div[not(contains(@class,'required'))]//label", "//div[@id='customQuestions']//div[not(contains(@class,'required'))]//label", "//div[not(contains(@class,'required')) and (@id='comments')]//label" }); for (String fieldsXpath : requiredFieldsList) { List<WebElement> optionalQuestionLableNameWebElements = this.driver .findElements(By.xpath(fieldsXpath)); for (WebElement webElement : optionalQuestionLableNameWebElements) { optionalQuestionLableNameList.add(webElement.getText()); } } return optionalQuestionLableNameList; } catch (Exception e) { return optionalQuestionLableNameList; } }
From source file:com.citrix.g2w.webdriver.pages.registration.RegistrationPage.java
License:Open Source License
/** * Method to return all required questions as list. * //from w w w. j a v a 2 s. c o m * @return (required question label name list) */ public List<String> getRequiredQuestions() { List<String> requiredQuestionLableNameList = new ArrayList<String>(); try { List<String> requiredFieldsList = Arrays.asList( new String[] { "//div[@id='studentInformation']//div[contains(@class,'required')]//label", "//div[@id='customQuestions']//div[contains(@class,'required')]//label", "//div[contains(@class,'required') and (@id='comments')]//label" }); for (String fieldsXpath : requiredFieldsList) { List<WebElement> requiredQuestionLableNameWebElements = this.driver .findElements(By.xpath(fieldsXpath)); for (WebElement webElement : requiredQuestionLableNameWebElements) { requiredQuestionLableNameList.add(webElement.getText()); } } return requiredQuestionLableNameList; } catch (Exception e) { return requiredQuestionLableNameList; } }
From source file:com.citrix.g2w.webdriver.pages.registration.RegistrationPage.java
License:Open Source License
public List<String> getRecurringWebinarTimesList() { List<String> webinarTimeStrs = new ArrayList<String>(); List<WebElement> recurringWebinarTimesList = null; try {/*from w w w.j a v a2 s. c om*/ recurringWebinarTimesList = findPresenceOfInnerTextForElements( By.xpath("//ol[@id='training-times']//li"), 30); } catch (Exception e) { clickWebinarsSizeLink(); recurringWebinarTimesList = findPresenceOfInnerTextForElements( By.xpath("//ol[@id='training-times']//li"), 30); } for (WebElement webinarTime : recurringWebinarTimesList) { webinarTimeStrs.add(webinarTime.getText().trim()); } return webinarTimeStrs; }
From source file:com.cloudbees.workflow.ui.view.PausedJobTest.java
License:Open Source License
@Ignore("remove phantomjs: https://trello.com/c/JpUg8S5z/159-get-rid-of-phantomjs-webdriver") @Test//w w w .jav a 2s .c o m public void test() throws Exception { WebDriver webdriver = getWebDriver(); WorkflowJob job = jenkinsRule.jenkins.createProject(WorkflowJob.class, "Noddy Job"); job.setDefinition(new CpsFlowDefinition("" + "node {" + " stage ('Build'); " + " echo ('build'); " + " input (message: 'Is the build okay?'); " + "}")); QueueTaskFuture<WorkflowRun> q = job.scheduleBuild2(0); WorkflowRun b = q.getStartCondition().get(); CpsFlowExecution e = (CpsFlowExecution) b.getExecutionPromise().get(); while (b.getAction(InputAction.class) == null) { e.waitForSuspension(); } String jobUrl = getItemUrl(jenkinsRule.jenkins, job); webdriver.get(jobUrl); // Make sure the stage cell was marked as pending input... List<WebElement> pausedStageCells = webdriver .findElements(By.cssSelector(".stage-cell.PAUSED_PENDING_INPUT .stage-wrapper")); Assert.assertEquals(1, pausedStageCells.size()); // Move over the paused build and check for the popup... moveMouseToElement(webdriver, pausedStageCells.get(0)); List<WebElement> inputRequiredPopovers = waitForElementsAdded(webdriver, ".cbwf-popover .run-input-required"); Assert.assertEquals(1, inputRequiredPopovers.size()); // Check the popup content... WebElement inputRequiredPopover = inputRequiredPopovers.get(0); WebElement message = inputRequiredPopover.findElement(By.cssSelector(".message")); Assert.assertEquals("Is the build okay?", message.getText()); // Click on the proceed button WebElement proceedBtn = inputRequiredPopover.findElement(By.cssSelector(".action.proceed")); // clickOnElement(webdriver, proceedBtn); // // // Wait for the build to complete successfully // Util.waitForBuildCount(job, 1, Result.SUCCESS); // // // Click on the proceed button and wait for the popup to disappear // waitForElementsRemoved(webdriver, ".cbwf-popover .run-input-required"); }
From source file:com.coderoad.automation.common.util.old.BasePage.java
License:Open Source License
/** * this method selects the options from the combobox. * //from w ww . j a va 2s .c o m * @param dropDown the drop down * @param option the option */ protected void selectOptionIn(WebElement dropDown, String option) { String triggerId = dropDown.getAttribute("id"); dropDown.findElement(By.id(triggerId)).click(); List<WebElement> options = getDriver().findElements(By.xpath("//li[@role='option']")); for (WebElement opt : options) { if (opt.getText().equals(option)) { opt.click(); break; } } }
From source file:com.coderoad.automation.common.util.old.BasePage.java
License:Open Source License
/** * select the model from the list of vehicle models. * /*www.ja v a2s.c o m*/ * @param models the models * @param modelCode the model code * @throws InterruptedException the interrupted exception */ public void selectVehicleModel(List<WebElement> models, String modelCode) throws InterruptedException { waitForVisibility(models.get(0)); for (WebElement model : models) { if (model.getText().equals(modelCode)) { model.click(); break; } } Thread.sleep(1000); }
From source file:com.coderoad.automation.common.util.PageUtil.java
License:Open Source License
/** * Gets the element by text.//from w w w. j av a2s. c o m * * @param driver the driver * @param locator the locator * @param innerText the inner text * @param timeout the timeout * @return the element by text */ public static WebElement getElementByText(final WebDriver driver, final By locator, final String innerText, final Timeout timeout) { for (final WebElement webElement : getElements(driver, locator, timeout)) { if (webElement.isDisplayed() && webElement.isEnabled() && webElement.getText().trim().equalsIgnoreCase(innerText)) { return webElement; } } return null; }