List of usage examples for org.openqa.selenium WebElement isSelected
boolean isSelected();
From source file:org.wso2.am.integration.ui.tests.APIMANAGER3366MultipleGatewayPublishTestCase.java
License:Open Source License
@Test(groups = "wso2.am", description = "published with deselect environment") public void testPublishApiWithDeSelectEnvironment() throws Exception { driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")) .sendKeys(gatewayContext.getContextTenant().getContextUser().getUserName()); driver.findElement(By.id("pass")).clear(); driver.findElement(By.id("pass")) .sendKeys(gatewayContext.getContextTenant().getContextUser().getPassword()); driver.findElement(By.id("loginButton")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Add"))); driver.findElement(By.linkText("Add")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("create-new-api"))); driver.findElement(By.id("create-new-api")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("designNewAPI"))); driver.findElement(By.id("designNewAPI")).click(); driver.findElement(By.id("name")).clear(); driver.findElement(By.id("name")).sendKeys("publishWithEnvironments3"); driver.findElement(By.id("context")).clear(); driver.findElement(By.id("context")).sendKeys("publishWithEnvironments3"); driver.findElement(By.id("version")).clear(); driver.findElement(By.id("version")).sendKeys("1.0.0"); driver.findElement(By.id("description")).clear(); driver.findElement(By.id("description")).sendKeys(API_DESCRIPTION); driver.findElement(By.id("resource_url_pattern")).clear(); driver.findElement(By.id("resource_url_pattern")).sendKeys("*"); /*driver.findElement(By.id("inputResource")).clear(); driver.findElement(By.id("inputResource")).sendKeys("default");*/ driver.findElement(By.cssSelector("input.http_verb_select")).click(); driver.findElement(By.id("add_resource")).click(); driver.findElement(By.id("go_to_implement")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@value='#managed-api']"))); driver.findElement(By.xpath("//div[@value='#managed-api']")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("go_to_manage"))); driver.findElement(By.id("jsonform-0-elt-production_endpoints")).clear(); driver.findElement(By.id("jsonform-0-elt-production_endpoints")).sendKeys(API_URL); driver.findElement(By.id("go_to_manage")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("publish_api"))); driver.findElement(By.xpath("//button[@type='button']")).click(); driver.findElement(By.xpath("//input[@value='Gold']")).click(); driver.findElement(By.cssSelector("legend.legend-with-hidden-info.js_hidden_section_title")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input.env"))); WebElement checkBox = driver.findElement(By.cssSelector("input.env")); if (checkBox.isSelected()) { checkBox.click();//from w w w .j a v a2 s. c o m } driver.findElement(By.id("publish_api")).click(); Assert.assertTrue(!isAPIPublished("publishWithEnvironments3", "1.0.0"), "API is Successfully published with de select environment in environment section"); driver.findElement(By.id("userMenu")).click(); driver.findElement(By.cssSelector("button.btn.btn-danger")).click(); }
From source file:org.wso2.mb.integration.common.utils.ui.pages.main.QueueAddPage.java
License:Open Source License
/** * Adds a queue without privileges to any role or not explicitly specified * @param qName queue name//from w ww .ja va2 s . c o m * @param withoutPrivileges without privileges set to roles to consume or publish * @return true if successful and false otherwise * @throws IOException */ public boolean addQueue(final String qName, boolean withoutPrivileges) throws IOException { boolean isSuccessful = false; WebElement qNameField = driver .findElement(By.id(UIElementMapper.getInstance().getElement("mb.add.queue.page.qname.field.id"))); qNameField.sendKeys(qName); if (withoutPrivileges) { // get permission table WebElement table = driver.findElement( By.xpath(UIElementMapper.getInstance().getElement("mb.add.queue.page.permission.table"))); // get role name related publish consume checkboxes list for all the roles List<WebElement> checkBoxList = table.findElements(By.tagName("input")); // make all the permissions unchecked for (WebElement element : checkBoxList) { if (element.isSelected()) { element.click(); // uncheck checkbox } } } driver.getWindowHandle(); driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("mb.add.queue.page.add.button.xpath"))) .click(); String dialog = driver.getWindowHandle(); driver.switchTo().window(dialog); if (driver.findElement(By.id(UIElementMapper.getInstance().getElement("mb.popup.dialog.id"))).getText() .contains("Queue added successfully")) { isSuccessful = true; } driver.findElement(By.xpath( UIElementMapper.getInstance().getElement("mb.add.queue.page" + ".onqueueadd.okbutton.xpath"))) .click(); return isSuccessful; }
From source file:org.wso2.mb.integration.common.utils.ui.pages.main.QueueSubscriptionsPage.java
License:Open Source License
/** * Search queue subscriptions according to the search criteria. * * @param queueNamePattern string pattern of the queue name (* for all) * @param identifierPattern string pattern of the identifier (* for all) * @param ownNodeIdIndex index of the node Id in the dropdown the subscriptions belong to * @return number of subscriptions listed under search result *///w w w .ja v a 2 s . c o m public int searchQueueSubscriptions(String queueNamePattern, String identifierPattern, int ownNodeIdIndex, boolean isNameExactMatch, boolean isIdentifierExactMatch) { WebElement queueNamePatternField = driver.findElement( By.name(UIElementMapper.getInstance().getElement("mb.search.queue.name.pattern.tag.name"))); queueNamePatternField.clear(); queueNamePatternField.sendKeys(queueNamePattern); WebElement queueNameExactMatchField = driver.findElement( By.name(UIElementMapper.getInstance().getElement("mb.search.queue.name.exactmatch.tag.name"))); // Set the name exact match check box state based on the test input if (isNameExactMatch != queueNameExactMatchField.isSelected()) { queueNameExactMatchField.click(); } WebElement queueIdentifierExactMatchField = driver.findElement(By .name(UIElementMapper.getInstance().getElement("mb.search.queue.identifier.exactmatch.tag.name"))); // Set the identifier exact match check box state based on the test input if (isIdentifierExactMatch != queueIdentifierExactMatchField.isSelected()) { queueIdentifierExactMatchField.click(); } WebElement queueIdentifierPatternField = driver.findElement( By.name(UIElementMapper.getInstance().getElement("mb.search.queue.identifier.pattern.tag.name"))); queueIdentifierPatternField.clear(); queueIdentifierPatternField.sendKeys(identifierPattern); Select ownNodeIdDropdown = new Select(driver.findElement( By.id(UIElementMapper.getInstance().getElement("mb.search.queue.own.node.id.element.id")))); ownNodeIdDropdown.selectByIndex(ownNodeIdIndex); driver.findElement( By.xpath(UIElementMapper.getInstance().getElement("mb.search.queue.search.button.xpath"))).click(); return getSubscriptionCount(); }
From source file:org.wso2.mb.integration.common.utils.ui.pages.main.TopicSubscriptionsPage.java
License:Open Source License
/** * Search topic subscriptions according to the search criteria. * * @param queueNamePattern string pattern of the topic name (* for all) * @param identifierPattern string pattern of the identifier (* for all) * @param ownNodeIdIndex index of the node Id in the dropdown the subscriptions belong to * @return number of subscriptions listed under search result *//*w w w .j a v a 2 s .com*/ public void searchTopicSubscriptions(String queueNamePattern, String identifierPattern, int ownNodeIdIndex, boolean isNameExactMatch, boolean isIdentifierExactMatch) { WebElement queueNamePatternField = driver.findElement( By.name(UIElementMapper.getInstance().getElement("mb.search.topic.name.pattern.tag.name"))); queueNamePatternField.clear(); queueNamePatternField.sendKeys(queueNamePattern); WebElement queueIdentifierPatternField = driver.findElement( By.name(UIElementMapper.getInstance().getElement("mb.search.topic.identifier.pattern.tag.name"))); queueIdentifierPatternField.clear(); queueIdentifierPatternField.sendKeys(identifierPattern); WebElement topicNameExactMatchField = driver.findElement( By.name(UIElementMapper.getInstance().getElement("mb.search.topic.name.exactmatch.tag.name"))); // Set the name exact match check box state based on the test input if (isNameExactMatch != topicNameExactMatchField.isSelected()) { topicNameExactMatchField.click(); } WebElement topicIdentifierExactMatchField = driver.findElement(By .name(UIElementMapper.getInstance().getElement("mb.search.topic.identifier.exactmatch.tag.name"))); // Set the identifier exact match check box state based on the test input if (isIdentifierExactMatch != topicIdentifierExactMatchField.isSelected()) { topicIdentifierExactMatchField.click(); } Select ownNodeIdDropdown = new Select(driver.findElement( By.id(UIElementMapper.getInstance().getElement("mb.search.topic.own.node.id.element.id")))); ownNodeIdDropdown.selectByIndex(ownNodeIdIndex); driver.findElement( By.xpath(UIElementMapper.getInstance().getElement("mb.search.topic.search.button.xpath"))).click(); }
From source file:org.xwiki.administration.test.po.PresentationAdministrationSectionPage.java
License:Open Source License
/** * @return the current color theme//from www. ja v a 2 s . c o m */ public String getCurrentColorTheme() { for (WebElement option : getColorThemeOptions()) { if (option.isSelected()) { return option.getText(); } } return null; }
From source file:org.xwiki.administration.test.po.TemplateProviderInlinePage.java
License:Open Source License
public void setSpaces(List<String> spaces) { for (WebElement input : getSpacesInput()) { if (input.isSelected()) { input.click();/* w w w .j ava 2 s . c om*/ } if (spaces.contains(input.getAttribute("value"))) { input.click(); } } }
From source file:org.xwiki.administration.test.po.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 w ww. ja v a 2s . c om */ public List<String> getSelectedSpaces() { List<String> selectedSpaces = new ArrayList<String>(); for (WebElement input : getSpacesInput()) { if (input.isSelected()) { selectedSpaces.add(input.getAttribute("value")); } } return selectedSpaces; }
From source file:org.xwiki.administration.test.po.TemplateProviderInlinePage.java
License:Open Source License
/** * Sets all spaces besides the ones passed in the list. * //from w w w .j av a2 s .com * @param spaces the spaces to exclude */ public void excludeSpaces(List<String> spaces) { List<String> selectedSpaces = getSelectedSpaces(); // if there is no selected space or all the selected spaces will be unchecked upon excluding them if (selectedSpaces.size() == 0 || spaces.containsAll(selectedSpaces)) { // go through all the spaces and select them, and unselect the ones in the list to exclude for (WebElement input : getSpacesInput()) { // prevent checking the hidden fields with empty value if (!input.isSelected() && input.getAttribute("value").length() > 0) { input.click(); } if (spaces.contains(input.getAttribute("value"))) { input.click(); } } } else { // go through the spaces and make sure the exclude list is unselected for (WebElement input : getSpacesInput()) { if (spaces.contains(input.getAttribute("value")) && input.isSelected()) { input.click(); } } } }
From source file:org.xwiki.administration.test.ui.ImportIT.java
License:Open Source License
@Test @IgnoreBrowsers({/*from w ww . j a v a 2s .co m*/ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://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.ImportIT.java
License:Open Source License
@Test @IgnoreBrowsers({/*from w w w. j a v a 2 s . com*/ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://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()); }