List of usage examples for org.openqa.selenium WebElement getAttribute
String getAttribute(String name);
From source file:com.cisco.dbds.utils.primewidgets.pagefactory.primePageFactory.java
License:Open Source License
/** * Gets the submenu sel./*from ww w. jav a 2 s .co m*/ * * @param smname the smname * @return the submenu sel */ public WebElement getSUBMENU_SEL(String smname) { WebElement dupli = null; for (WebElement elem : WES_PRIME_USERS_ROLES_AAA_LINK_CSS_SEL) { String attr = elem.getAttribute("title"); if (attr.equals(smname)) { dupli = elem; } } return dupli; }
From source file:com.citrix.g2w.webdriver.pages.audio.AllConferenceCallNumbersPage.java
License:Open Source License
public String getThemeUrl() { WebElement themeUrlElement = driver.findElement(themeUrlBy); if (themeUrlElement != null) { this.logger.log("ThemeUrlElement" + themeUrlElement); return themeUrlElement.getAttribute("href"); }// w ww . j a va 2 s . c om return null; }
From source file:com.citrix.g2w.webdriver.pages.ManageWebinarPage.java
License:Open Source License
/** * Gets list of webinar keys for a recurring webinar. * @return listOfWebinargKeys list of the webinar key in the recurring webinar series *//*from w w w . j av a 2 s.co m*/ public List<Long> getListOfWebinarKeysForRecurringWebinar() { List<Long> listOfWebinarKeys = new ArrayList<Long>(); List<WebElement> elements = this.driver.findElements(this.webinarKeysElement); for (WebElement element : elements) { String id = element.getAttribute("id"); Pattern webinarKeyP = Pattern.compile("[0-9]+"); Matcher m = webinarKeyP.matcher(id); if (m.find()) { id = m.group(); } listOfWebinarKeys.add(Long.parseLong(id)); } this.logger.log("The list of webinar keys for a recurring webinar are : " + listOfWebinarKeys); return listOfWebinarKeys; }
From source file:com.citrix.g2w.webdriver.pages.recordings.MyRecordingsPage.java
License:Open Source License
/** * Get list of recording ids/*from www. java2 s . c o m*/ * * @return List */ public List<String> getRecordingIds() { List<String> recordingUrls = new ArrayList<String>(); for (WebElement recordingUrlLink : removeRecordingLinks) { recordingUrls.add(recordingUrlLink.getAttribute("data-webinarKey")); } return recordingUrls; }
From source file:com.citrix.g2w.webdriver.pages.registration.RegistrationPage.java
License:Open Source License
public String getThemeUrl() { try {/*www .jav a 2s. c o m*/ WebElement themeUrlElement = driver.findElement(themeUrlBy); if (themeUrlElement != null) { this.logger.log("ThemeUrlElement" + themeUrlElement); return themeUrlElement.getAttribute("href"); } } catch (NoSuchElementException nse) { this.logger.log("NoSuchElementException "); } return null; }
From source file:com.coderoad.automation.common.util.old.BasePage.java
License:Open Source License
/** * this method selects the options from the combobox. * //w ww . j a v a 2 s . 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.PageUtil.java
License:Open Source License
/** * Method to set date in a date picker/*from w w w . jav a 2s . c o m*/ * @author Ruth Chirinos * @param driver the WebDriver * @param xpathDatePicker the xpath of the datePicker * @param vehicleSelectionPage * year - the year minus 1900. * month - the month between 0-11. * date - the day of the month between 1-31. * @throws InterruptedException * @throws ParseException */ public static boolean setDateInDatePicker(WebDriver driver, String xpathDatePicker, Date dateRequested) throws InterruptedException, ParseException { Calendar dateRequestedCalendar = DateUtil.getCalendarForDate(dateRequested); LogUtil.log("Date for changing is > " + DateUtil.format(dateRequestedCalendar, DateUtil.DATE_MONTH_ABBREVIATION), LogLevel.LOW); boolean processOk = false; String dateSelectedString = ""; Date dateSelected = null; SimpleDateFormat simpleFormat = new SimpleDateFormat(DateUtil.DATE_MONTH_YEAR_FMT); WebElement datePicker = driver.findElement(By.xpath(xpathDatePicker)); datePicker.click(); WebElement monthYearElement = driver .findElement(By.xpath("//div[@class='x-datepicker-month']/div/div/a/span[1]")); WebElement daySelected = driver.findElement(By.xpath("//*[contains(@class, 'x-datepicker-selected')]/a")); dateSelectedString = daySelected.getAttribute("innerHTML") + " " + monthYearElement.getAttribute("innerHTML"); dateSelected = simpleFormat.parse(dateSelectedString); WebElement pickerPrevEl = driver.findElement( By.xpath("//div[@class='x-datepicker-header']/a[contains(@class, 'x-datepicker-prev')]")); WebElement pickerNextEl = driver.findElement( By.xpath("//div[@class='x-datepicker-header']/a[contains(@class, 'x-datepicker-next')]")); //Choosing the year while (dateRequested.getYear() < dateSelected.getYear()) { pickerPrevEl.click(); monthYearElement = driver.findElement(By.xpath("//div[@class='x-datepicker-month']/div/div/a/span[1]")); dateSelectedString = daySelected.getAttribute("innerHTML") + " " + monthYearElement.getAttribute("innerHTML"); dateSelected = simpleFormat.parse(dateSelectedString); } while (dateRequested.getYear() > dateSelected.getYear()) { pickerNextEl.click(); monthYearElement = driver.findElement(By.xpath("//div[@class='x-datepicker-month']/div/div/a/span[1]")); dateSelectedString = daySelected.getAttribute("innerHTML") + " " + monthYearElement.getAttribute("innerHTML"); dateSelected = simpleFormat.parse(dateSelectedString); } //Choosing the months while (dateRequested.getMonth() < dateSelected.getMonth()) { pickerPrevEl.click(); monthYearElement = driver.findElement(By.xpath("//div[@class='x-datepicker-month']/div/div/a/span[1]")); dateSelectedString = daySelected.getAttribute("innerHTML") + " " + monthYearElement.getAttribute("innerHTML"); dateSelected = simpleFormat.parse(dateSelectedString); } while (dateRequested.getMonth() > dateSelected.getMonth()) { pickerNextEl.click(); monthYearElement = driver.findElement(By.xpath("//div[@class='x-datepicker-month']/div/div/a/span[1]")); dateSelectedString = daySelected.getAttribute("innerHTML") + " " + monthYearElement.getAttribute("innerHTML"); dateSelected = simpleFormat.parse(dateSelectedString); } //Choosing the day WebElement dateWidget = driver.findElement(By.className("x-datepicker-inner")); List<WebElement> columns = dateWidget.findElements(By.tagName("td")); int aux = 0; for (WebElement cell : columns) { if (cell.getText().equals(dateRequested.getDate() + "")) { processOk = cell.getAttribute("class").contains("x-datepicker-active"); if (processOk) { cell.findElement(By.tagName("a")).click(); ; LogUtil.log("The date was selected.", LogLevel.LOW); aux = 1; break; } } } if (aux == 0) { LogUtil.log("The date selected is not enabled.", LogLevel.LOW); } return processOk; }
From source file:com.coderoad.automation.rocketTruedx.RocketTruedxNaBasePage.java
License:Open Source License
/** * this method sets the state of the checkbox. * //from ww w . j ava2 s . c o m * @param fieldName the field name * @param state the state */ protected void setCheckBoxState(WebElement fieldName, boolean state) { String id = fieldName.getAttribute("id"); String classStr = fieldName.getAttribute("class"); TestLogger.logDebug(id + ":" + classStr); WebElement checkboxElem = getDriver().findElement(By.id(id + "-inputEl")); // rememberMeCb-inputEl if (classStr.contains("x-form-cb-checked")) if (!state) { checkboxElem.click(); } else { TestLogger.logDebug("Check box already Checked"); } else { if (state) { checkboxElem.click(); } else { TestLogger.logDebug("Check box already unchecked"); } } classStr = fieldName.getAttribute("class"); TestLogger.logDebug(id + ":" + classStr + ":" + state); }
From source file:com.coderoad.automation.rocketTruedx.RocketTruedxNaBasePage.java
License:Open Source License
/** * this method return the state of the check box. * /*w w w .ja v a 2s . c o m*/ * @param fieldName the field name * @return the check box state */ protected boolean getCheckBoxState(WebElement fieldName) { String classStr = fieldName.getAttribute("class"); if (classStr.contains("x-form-cb-checked")) return true; else return false; }
From source file:com.coderoad.automation.rocketTruedx.RocketTruedxNaBasePage.java
License:Open Source License
/** * this method selects the options from the combobox. * //from www .ja va 2 s. com * @param dropDown the drop down * @param option the option */ protected void selectOptionIn(WebElement dropDown, String option) { String triggerId = dropDown.getAttribute("id"); WebElement arrow = dropDown.findElement(By.id(triggerId)); if (arrow.isDisplayed()) { arrow.click(); } WaitUtil.waitUntil(5); List<WebElement> options = getDriver().findElements(By.xpath("//li[@role='option']")); for (WebElement opt : options) { if (opt.getText().equalsIgnoreCase(option)) { click(opt); WaitUtil.waitUntil(2); break; } } }