List of usage examples for org.openqa.selenium WebElement isSelected
boolean isSelected();
From source file:edu.samplu.common.WebDriverLegacyITBase.java
License:Educational Community License
protected void check(By by) throws InterruptedException { WebElement element = driver.findElement(by); if (!element.isSelected()) { element.click();// w ww .j a v a 2 s. c om } }
From source file:edu.samplu.common.WebDriverLegacyITBase.java
License:Educational Community License
protected void uncheck(By by) throws InterruptedException { WebElement element = driver.findElement(by); if (element.isSelected()) { element.click();/*from w ww . java 2s . c o m*/ } }
From source file:fll.web.IntegrationTestUtils.java
License:Open Source License
/** * Get the id of the current tournament//from w w w .j a v a2s . co m * * @throws IOException * @throws InterruptedException */ public static int getCurrentTournamentId(final WebDriver selenium) throws IOException, InterruptedException { loadPage(selenium, TestUtils.URL_ROOT + "admin/index.jsp"); final WebElement currentTournament = selenium.findElement(By.id("currentTournamentSelect")); final Select currentTournamentSel = new Select(currentTournament); for (final WebElement option : currentTournamentSel.getOptions()) { if (option.isSelected()) { final String idStr = option.getAttribute("value"); return Integer.valueOf(idStr); } } throw new FLLInternalException("Cannot find default tournament"); }
From source file:gov.nasa.jpl.memex.nutch.protocol.selenium.handlers.login.LoginHandler34.java
License:Apache License
public void processDriver(WebDriver driver) { try {/*w w w . j av a 2s . c o m*/ String accumulatedData = ""; driver.findElement(By.tagName("body")).getAttribute("innerHTML"); Configuration conf = NutchConfiguration.create(); new WebDriverWait(driver, 5); WebElement username = driver.findElement(By.id("username")); username.sendKeys("412651408@qq.com"); WebElement password = driver.findElement(By.id("password")); password.sendKeys("z123456"); WebElement autologin = driver.findElement(By.id("autologin")); if (!autologin.isSelected()) { autologin.click(); } WebElement login = driver.findElement(By.name("longin")); login.click(); (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By.className("forabg"))); // Cookie cookie1 = new Cookie("phpbb3_63hz5_sid", "aa31814a45de62c5aa231456f190bf7a"); // driver.manage().addCookie(cookie1); // Cookie cookie2 = new Cookie("phpbb3_63hz5_u", "12328"); // driver.manage().addCookie(cookie2); // Cookie cookie3 = new Cookie("phpbb3_63hz5_k", ""); // driver.manage().addCookie(cookie3); // Cookie cookie4 = new Cookie("style_cookie", "null"); // driver.manage().addCookie(cookie4); // JavascriptExecutor jsx = (JavascriptExecutor) driver; // jsx.executeScript("document.body.innerHTML=document.body.innerHTML " + accumulatedData + ";"); } catch (Exception e) { LOG.info(StringUtils.stringifyException(e)); } }
From source file:gov.nih.nci.firebird.selenium2.pages.login.RequestAccountPage.java
License:Open Source License
public void selectSponsorRoleRadio(Organization sponsor) { WebElement radioButton = getDriver().findElement(By.id(SPONSOR_ROLE_PREFIX + sponsor.getExternalId())); if (!radioButton.isSelected()) { radioButton.click();//from w w w . j av a 2s. c o m } }
From source file:gov.nih.nci.firebird.selenium2.pages.login.RequestAccountPage.java
License:Open Source License
public void selectSponsorDelegateRoleRadio(Organization sponsor) { WebElement radioButton = getDriver().findElement(By.id(DELEGATE_ROLE_PREFIX + sponsor.getExternalId())); if (!radioButton.isSelected()) { radioButton.click();//from w w w .j a va2s . c o m } }
From source file:io.github.seleniumquery.by.css.pseudoclasses.CheckedPseudoClass.java
License:Apache License
public boolean isChecked(WebElement element) { // #Cross-Driver // PhantomJS: When we call element.isSelected() on an element that is not selectable, // PhantomJS throws an exception, so we must check the element type before calling isSelected(). return isCheckableTag(element) && element.isSelected(); }
From source file:io.github.seleniumquery.by.css.pseudoclasses.SelectedPseudoClass.java
License:Apache License
public boolean isSelected(WebElement element) { return isOptionTag(element) && element.isSelected(); }
From source file:io.github.seleniumquery.by.firstgen.css.pseudoclasses.CheckedPseudoClass.java
License:Apache License
private boolean isChecked(WebElement element) { // #Cross-Driver // PhantomJS: When we call element.isSelected() on an element that is not selectable, // PhantomJS throws an exception, so we must check the element type before calling isSelected(). return isCheckableTag(element) && element.isSelected(); }
From source file:io.github.seleniumquery.by.firstgen.css.pseudoclasses.SelectedPseudoClass.java
License:Apache License
private boolean isSelected(WebElement element) { return isOptionTag(element) && element.isSelected(); }