List of usage examples for org.openqa.selenium By partialLinkText
public static By partialLinkText(String partialLinkText)
From source file:contentspeededgedriver.ProdusCeai.java
void clickFinalizeaza() { try {// w ww .j a v a2 s . c o m String MainWindow = driver.getWindowHandle(); // To handle all new opened window. Set<String> s1 = driver.getWindowHandles(); Iterator<String> i1 = s1.iterator(); while (i1.hasNext()) { String ChildWindow = i1.next(); driver.switchTo().window(ChildWindow); driver.findElement(By.partialLinkText("Finalizeaza comanda")).click(); } } catch (WebDriverException ex) { ex.printStackTrace(); //driver.quit(); } }
From source file:contentspeededgedriver.ProdusCeai.java
void CosClick() { //driver.findElement(cosComanda).click(); Actions actions = new Actions(driver); actions.click(driver.findElement(cosComanda)).perform(); String MainWindow = driver.getWindowHandle(); Set<String> s1 = driver.getWindowHandles(); Iterator<String> i1 = s1.iterator(); //System.out.println(s1.size()); while (i1.hasNext()) { String ChildWindow = i1.next(); driver.switchTo().window(ChildWindow); driver.findElement(By.partialLinkText("Vezi cosul")).click(); }/*from w w w.jav a 2 s.co m*/ }
From source file:de.akquinet.devops.test.ui.view.GitblitDashboardView.java
License:Apache License
public boolean isLoginPartVisible() { List<WebElement> found = getDriver().findElements(By.partialLinkText("logout")); return found == null || found.size() == 0; }
From source file:de.akquinet.devops.test.ui.view.RepoEditView.java
License:Apache License
public boolean navigateToPermissionsTab() { String linkText = "access permissions"; List<WebElement> found = getDriver().findElements(By.partialLinkText(linkText)); if (found != null && found.size() == 1) { found.get(0).click();// ww w.ja v a 2 s . c o m return true; } return false; }
From source file:de.akquinet.devops.test.ui.view.RepoListView.java
License:Apache License
private boolean checkOrDoDeleteRepo(String fullyQualifiedRepoPathAndName, boolean doDelete) { List<WebElement> found = getDriver().findElements(By.partialLinkText("delete")); String onclickIdentifier = getDeleteRepoOnclickIdentifier(fullyQualifiedRepoPathAndName); WebElement result = null;//from w ww. ja va2 s .co m for (WebElement webElement : found) { if (webElement.getAttribute("onclick") != null && webElement.getAttribute("onclick").equals(onclickIdentifier)) { result = webElement; break; } } System.out.println("result ? " + result); if (result == null) { return false; } if (doDelete) { System.out.println(".............. DO DELETE .... "); result.click(); } return true; }
From source file:de.tklerx.run.ResEntries.java
License:Open Source License
private void run() throws Exception { init_Browser();//from w ww . j a va2s .c o m loadStartPage(); page_loginRegister_FormLogin_FillSend(); // secNavi_LinkTestautomatisierung_Click(); Thread.sleep(CLICK_WAIT_TIME); driver.findElement(By.partialLinkText("Kontrolle")).click(); Thread.sleep(CLICK_WAIT_TIME); driver.findElement(By.partialLinkText("Spieler")).click(); Thread.sleep(CLICK_WAIT_TIME); driver.findElement(By.xpath("//input[@type=\"submit\" and @value=\"Suchen\"]")).click(); Thread.sleep(10000); List<String> otherPlayerPages = new ArrayList<>(); parsePlayerPage(otherPlayerPages); // System.out.println(otherPlayerPages); for (String s : otherPlayerPages) { driver.get(s); Thread.sleep(CLICK_WAIT_TIME); parsePlayerPage(); } // for (Player p : playerPages) { // processPlayer(p); // break; // } }
From source file:de.tntinteractive.portalsammler.sources.DocumentSource.java
License:Open Source License
protected static void clickLink(final WebDriver driver, final String partialText) { final WebElement link = driver.findElement(By.partialLinkText(partialText)); link.click();//w w w.j a va 2 s . c o m }
From source file:de.tntinteractive.portalsammler.sources.IngDibaSourceV1.java
License:Open Source License
@Override public Pair<Integer, Integer> poll(final SourceSettings settings, final UserInteraction gui, final SecureStore store) throws Exception { final WebDriver driver = this.createDriver("https://banking.ing-diba.de/app/login"); final WebElement userField = driver.findElement(By.name("view:kontonummer:border:border_body:kontonummer")); userField.sendKeys(settings.get(USER, gui)); final WebElement passwordField = driver.findElement(By.name("view:pin:border:border_body:pin")); passwordField.sendKeys(settings.get(PASSWORD, gui)); passwordField.submit();/* w ww . j a va2 s . com*/ waitForPresence(driver, By.className("dbkpBoard")); final List<Integer> missingValues = new ArrayList<Integer>(); for (final WebElement possibleKeyInput : driver.findElements(By.tagName("input"))) { final String missingValuePrefix = "view:key:border:border_body:key:dbkpDisplayDiv:values:"; final String name = possibleKeyInput.getAttribute("name"); if (startsWith(name, missingValuePrefix)) { final String s = name.substring(missingValuePrefix.length(), missingValuePrefix.length() + 1); missingValues.add(Integer.parseInt(s)); } } final String code = settings.get(CODE, gui); for (final Integer missing : missingValues) { final String number = Character.toString(code.charAt(missing)); clickButton(driver, number); } clickButton(driver, "Anmelden"); waitForPresence(driver, By.partialLinkText("Post-Box")); clickLink(driver, "Post-Box"); (new WebDriverWait(driver, WAIT_TIME)) .until(ExpectedConditions.invisibilityOfElementLocated(By.id("busy"))); int newDocs = 0; int knownDocs = 0; try { final FileDownloader d = new FileDownloader(driver); for (final WebElement row : driver.findElements(By.tagName("tbody"))) { final DocumentInfo metadata = DocumentInfo.create(this.getId(), DocumentFormat.PDF); for (final WebElement cell : row.findElements(By.tagName("td"))) { final String text = cell.getText(); if (this.isDate(text)) { metadata.setDate(parseDate(text)); } else { metadata.addKeywords(text); } } if (!store.containsDocument(metadata)) { final WebElement link = row.findElement(By.tagName("a")); final byte[] file = d.downloadFile(link); store.storeDocument(metadata, file); newDocs++; } else { knownDocs++; } } } finally { clickLink(driver, "Log-out"); } return Pair.of(newDocs, knownDocs); }
From source file:dk.netarkivet.systemtest.functional.SelectiveHarvestTest.java
License:Open Source License
/** * Test creates 8 distinct harvest configurations corresponding to two different values for each of 3 * parameters defined in the EAV model (2=8). In addition, there are created 3 configurations using the * same cxml and attribute values as 3 of the previous 8 jobs. So there should be * eight jobs created./* w w w.j av a 2s. c o m*/ */ @Test(groups = { "guitest", "functest" }) public void jobSplittingTest() { final String domainRandomString = RandomStringUtils.random(6, true, true); final String configRandomString = RandomStringUtils.random(6, true, true); final String configName = "newconf_" + configRandomString; List<String> domainList = new ArrayList<String>(); for (int i = 0; i <= 10; i++) { domainList.add("d" + i + "-" + domainRandomString + ".dk"); } createDomainAndConfiguration(domainList.get(0), configName, 10, false, false); createDomainAndConfiguration(domainList.get(1), configName, 10, false, true); createDomainAndConfiguration(domainList.get(2), configName, 10, true, false); createDomainAndConfiguration(domainList.get(3), configName, 10, true, true); createDomainAndConfiguration(domainList.get(4), configName, 20, false, false); createDomainAndConfiguration(domainList.get(5), configName, 20, false, true); createDomainAndConfiguration(domainList.get(6), configName, 20, true, false); createDomainAndConfiguration(domainList.get(7), configName, 20, true, true); //The next three configs are identical to three of the above so they should //not generate new jobs - so only 8 jobs expected. createDomainAndConfiguration(domainList.get(8), configName, 20, true, true); createDomainAndConfiguration(domainList.get(9), configName, 20, true, false); createDomainAndConfiguration(domainList.get(10), configName, 20, false, true); final String harvestName = "splitharvest_" + RandomStringUtils.random(6, true, true); SelectiveHarvestPageHelper.createSelectiveHarvest(harvestName, "", (String[]) domainList.toArray(new String[] {})); SelectiveHarvestPageHelper.editHarvest(harvestName); WebElement table = PageHelper.getWebDriver().findElement(By.className("selection_table")); List<WebElement> selects = table.findElements(By.tagName("select")); for (WebElement select : selects) { Select dropdown = new Select(select); dropdown.selectByVisibleText(configName); } PageHelper.getWebDriver().findElement(By.name("save")).click(); SelectiveHarvestPageHelper.activateHarvest(harvestName); HarvestUtils.waitForJobGeneration(harvestName); List<WebElement> links = PageHelper.getWebDriver().findElements(By.partialLinkText(harvestName)); assertEquals(links.size(), 8, "Expected to generate one job per distinct configuration."); }
From source file:dk.netarkivet.systemtest.functional.SelectiveHarvestTest.java
License:Open Source License
/** * In this test we first set the cfg for every known domain to be identical. Then we make changes in * a number of them and check that the right number of jobs is generated. */// ww w . j a v a 2s.com @Test(groups = { "guitest", "functest" }) public void snapshotTest() { List<String> editDomainLinks = DomainWebTestHelper.getAllEditDomainLinks(); for (String link : editDomainLinks) { driver.get(link); WebElement editAnchor = driver.findElement(By.id("configuration")).findElement(By.linkText("Edit")); driver.get(editAnchor.getAttribute("href")); Select order_xml = new Select(driver.findElement(By.name("order_xml"))); order_xml.selectByVisibleText("default_orderxml"); driver.findElement(By.name("maxObjects")).clear(); driver.findElement(By.name("maxObjects")).sendKeys("10"); driver.findElement(By.name("maxBytes")).clear(); driver.findElement(By.name("maxBytes")).sendKeys("100000"); DomainConfigurationPageHelper.setMaxHops(10); DomainConfigurationPageHelper.setHonorRobots(true); DomainConfigurationPageHelper.setExtractJavascript(true); DomainConfigurationPageHelper.submitChanges(); } driver.get(editDomainLinks.get(0)); WebElement editAnchor = driver.findElement(By.id("configuration")).findElement(By.linkText("Edit")); driver.get(editAnchor.getAttribute("href")); DomainConfigurationPageHelper.setMaxHops(20); DomainConfigurationPageHelper.submitChanges(); driver.get(editDomainLinks.get(1)); editAnchor = driver.findElement(By.id("configuration")).findElement(By.linkText("Edit")); driver.get(editAnchor.getAttribute("href")); DomainConfigurationPageHelper.setHonorRobots(false); DomainConfigurationPageHelper.submitChanges(); driver.get(editDomainLinks.get(2)); editAnchor = driver.findElement(By.id("configuration")).findElement(By.linkText("Edit")); driver.get(editAnchor.getAttribute("href")); DomainConfigurationPageHelper.setExtractJavascript(false); DomainConfigurationPageHelper.submitChanges(); //So now a snapshot harvest should create four jobs PageHelper.gotoPage(PageHelper.MenuPages.SnapshotHarvests); final String harvestName = "snapshot_" + RandomStringUtils.random(3, true, true); driver.findElement(By.partialLinkText("Create new snapshot harvest definition")).click(); driver.findElement(By.name("harvestname")).sendKeys(harvestName); driver.findElement(By.name("snapshot_byte_limit")).clear(); driver.findElement(By.name("snapshot_byte_limit")).sendKeys("1000000"); driver.findElement(By.name("snapshot_byte_limit")).submit(); driver.findElement(By.cssSelector("input[value=\"" + harvestName + "\"]")).submit(); HarvestUtils.waitForJobGeneration(harvestName); List<WebElement> links = PageHelper.getWebDriver().findElements(By.partialLinkText(harvestName)); assertEquals(links.size(), 4, "Expected to generate one job per distinct configuration."); }