List of usage examples for org.openqa.selenium WebElement isSelected
boolean isSelected();
From source file:org.xwiki.administration.test.ui.ImportTest.java
License:Open Source License
@Test @IgnoreBrowsers({//from w w w. java2s . co m @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") }) public void testImportAsBackup() { URL fileUrl = this.getClass().getResource("/" + BACKUP_PACKAGE); this.sectionPage.attachPackage(fileUrl); this.sectionPage.selectPackage(BACKUP_PACKAGE); WebElement importAsBackup = getDriver().findElement(By.name("importAsBackup")); Assert.assertTrue(importAsBackup.isSelected()); this.sectionPage.importPackage(); ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage"); // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs // will race for completion. Let's wait for comments first. importedPage.openCommentsDocExtraPane(); HistoryPane history = importedPage.openHistoryDocExtraPane(); Assert.assertEquals("JohnDoe", history.getCurrentAuthor()); }
From source file:org.xwiki.administration.test.ui.ImportTest.java
License:Open Source License
@Test @IgnoreBrowsers({/* w w w .j a v a2s. c om*/ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") }) public void testImportWhenImportAsBackupIsNotSelected() { URL fileUrl = this.getClass().getResource("/" + BACKUP_PACKAGE); this.sectionPage.attachPackage(fileUrl); this.sectionPage.selectPackage(BACKUP_PACKAGE); WebElement importAsBackup = getDriver().findElement(By.name("importAsBackup")); importAsBackup.click(); Assert.assertFalse(importAsBackup.isSelected()); this.sectionPage.importPackage(); ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage"); // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs // will race for completion. Let's wait for comments first. importedPage.openCommentsDocExtraPane(); HistoryPane history = importedPage.openHistoryDocExtraPane(); Assert.assertEquals("superadmin", history.getCurrentAuthor()); }
From source file:org.xwiki.appwithinminutes.test.po.StaticListClassFieldEditPane.java
License:Open Source License
/** * @return the list of selected items/*from w w w .j a v a 2 s.co m*/ */ protected List<WebElement> getSelectedItems() { By xpath = By.xpath(".//*[local-name() = 'option' or @type = 'radio' or @type = 'checkbox']"); List<WebElement> selectedItems = new ArrayList<WebElement>(); for (WebElement item : getUtil().findElementsWithoutWaiting(getDriver(), defaultValueContainer, xpath)) { if (item.isSelected()) { selectedItems.add(item); } } return selectedItems; }
From source file:org.xwiki.appwithinminutes.test.po.UserClassFieldEditPane.java
License:Open Source License
/** * Sets whether this field supports multiple selection. * /*from w ww .j a v a2s . c o m*/ * @param multiple {@code true} to enable multiple selection, {@code false} to disable it */ public void setMultipleSelect(boolean multiple) { WebElement multiSelectCheckBox = getPropertyInput("multiSelect"); if (multiSelectCheckBox.isSelected() != multiple) { multiSelectCheckBox.click(); } }
From source file:org.xwiki.blog.test.po.BlogPostInlinePage.java
License:Open Source License
/** * Selects the specified categories./*from w ww. j a v a 2 s .c o m*/ * * @param categories the list of categories to select */ public void setCategories(List<String> categories) { for (String categoryName : categories) { String categoryReference = categoryName; if (categoryReference.indexOf('.') < 0) { categoryReference = "Blog." + categoryName; } String categoryXPath = "//input[@name = 'Blog.BlogPostClass_0_category' and @value = '" + categoryReference + "']"; for (WebElement category : categoryList.findElements(By.xpath(categoryXPath))) { if (!category.isSelected()) { category.click(); } } } }
From source file:org.xwiki.blog.test.po.BlogPostInlinePage.java
License:Open Source License
/** * @return the list of selected categories */// w w w. j a v a2s . c om public List<String> getCategories() { List<String> categories = new ArrayList<String>(); for (WebElement category : categoryList .findElements(By.xpath("//input[@name = 'Blog.BlogPostClass_0_category']"))) { if (category.isSelected()) { categories.add(StringUtils.substringAfter(category.getAttribute("value"), ".")); } } return categories; }
From source file:org.xwiki.blog.test.po.BlogPostInlinePage.java
License:Open Source License
/** * @return {@code true} if the blog post has been published, {@code false} otherwise *//*w ww .ja v a 2 s . c om*/ public boolean isPublished() { for (WebElement publishCheckBox : getDriver().findElements(By.id("Blog.BlogPostClass_0_published"))) { return publishCheckBox.isSelected(); } // When editing a published blog post the publish check box is not displayed. return true; }
From source file:org.xwiki.blog.test.po.BlogPostInlinePage.java
License:Open Source License
/** * Publish the blog post after it is saved. * /* w w w. j a v a 2s . com*/ * @param published whether to publish the blog post or not */ public void setPublished(boolean published) { for (WebElement publishCheckBox : getDriver().findElements(By.id("Blog.BlogPostClass_0_published"))) { if (publishCheckBox.isSelected() != published) { publishCheckBox.click(); } } }
From source file:org.xwiki.test.ui.administration.elements.TemplateProviderInlinePage.java
License:Open Source License
public void setSpaces(List<String> spaces) { for (WebElement input : getSpacesInput()) { if (input.isSelected()) { input.toggle();//from ww w . j a v a 2s . c om } if (spaces.contains(input.getValue())) { input.toggle(); } } }
From source file:org.xwiki.test.ui.administration.elements.TemplateProviderInlinePage.java
License:Open Source License
/** * @return the list of _actually_ checked spaces. If none is checked it actually means that the template is * available in all spaces//from www .j av a 2s. c o m */ public List<String> getSelectedSpaces() { List<String> selectedSpaces = new ArrayList<String>(); for (WebElement input : getSpacesInput()) { if (input.isSelected()) { selectedSpaces.add(input.getValue()); } } return selectedSpaces; }