@Override public void mouseMoveAt(String locator, String coordString) { WebElement webElement = getWebElement(locator); WrapsDriver wrapsDriver = (WrapsDriver) webElement; WebDriver webDriver = wrapsDriver.getWrappedDriver(); Actions actions = new Actions(webDriver); if (coordString.contains(",")) { String[] coords = coordString.split(","); int x = GetterUtil.getInteger(coords[0]); int y = GetterUtil.getInteger(coords[1]); actions.moveToElement(webElement, x, y); actions.clickAndHold(webElement); } else { actions.moveToElement(webElement); actions.clickAndHold(webElement); } Action action = actions.build(); action.perform(); }
@Test public void testDataViewTreeMapPopUpData() { searchByLinkAndClick(CLUSTER_VIEW_LABEL); searchByLinkAndClick(DATA_DROPDOWN_ID); WebElement TreeMapMember = driver.findElement(By.id("GraphTreeMapClusterData-canvas")); Actions builder = new Actions(driver); builder.clickAndHold(TreeMapMember).perform(); String RegionType = driver .findElement(By.xpath("//div[@id='_tooltip']/div/div/div[2]/div/div[2]/div")) .getText(); String regionType = JMXProperties.getInstance().getProperty("region.R2.regionType"); Assert.assertEquals(regionType, RegionType); String EntryCount = driver .findElement(By.xpath("//div[@id='_tooltip']/div/div/div[2]/div[2]/div[2]/div")) .getText(); String entryCount = JMXProperties.getInstance().getProperty("region.R2.systemRegionEntryCount"); Assert.assertEquals(entryCount, EntryCount); String EntrySizetemp = driver .findElement(By.xpath("//div[@id='_tooltip']/div/div/div[2]/div[3]/div[2]/div")) .getText(); float EntrySize = Float.parseFloat(EntrySizetemp); float entrySize = Float.parseFloat(JMXProperties.getInstance().getProperty("region.R2.entrySize")); entrySize = entrySize / 1024 / 1024; entrySize = Float.parseFloat(new DecimalFormat("##.####").format(entrySize)); Assert.assertEquals(entrySize, EntrySize); builder.moveToElement(TreeMapMember).release().perform(); }
@Override public void mouseMove(String locator) { WebElement webElement = getWebElement(locator); WrapsDriver wrapsDriver = (WrapsDriver) webElement; WebDriver webDriver = wrapsDriver.getWrappedDriver(); Actions actions = new Actions(webDriver); actions.moveToElement(webElement); actions.clickAndHold(webElement); Action action = actions.build(); action.perform(); }
/** * Dragging of the div and moving it is not happening. This needs to be investigated. * * <p>Points collected from investigation of the problem thus far 1. Manually dragging through the * UI happens when we get the mouse over a div (class=ui-dialog-titlebar ui-widget-header * ui-corner-all ui-helper-clearfix) and this can then be moved around 2. When running through * webdriver, this div does not appear in the dom. When we doa driver.findElement we dont get an * elementNotFound but ElementNotVisible instead. Not sure what is going on. This needs tobe * investigated further. */ public void clickAndDragThisWindow() { this.driver.manage().window().maximize(); Actions builder = new Actions(this.driver); // WebElement we = this.driver // .findElement(By // .cssSelector(".ui-dialog-titlebar.ui-widget-header.ui-corner-all.ui-helper-clearfix")); // builder.moveToElement(we).build().perform(); WebDriverWait wait = new WebDriverWait(this.driver, 10); WebElement div = wait.until( ExpectedConditions.visibilityOfElementLocated( By // .cssSelector(".ui-dialog-titlebar.ui-widget-header.ui-corner-all.ui-helper-clearfix"))); .id("flagForCurationDialog"))); div.click(); Point p = div.getLocation(); int x = p.x; int y = p.y; builder.clickAndHold(div).moveByOffset(x + 300, y + 400).release().perform(); }
public void testTreeMapPopUpData(String S1, String gridIcon) { for (int i = 1; i <= 3; i++) { searchByLinkAndClick(CLUSTER_VIEW_LABEL); if (gridIcon.equals(SERVER_GROUP_GRID_ID)) { WebElement ServerGroupRadio = driver.findElement(By.xpath("//label[@for='radio-servergroups']")); ServerGroupRadio.click(); } if (gridIcon.equals(REDUNDANCY_GRID_ID)) { WebElement ServerGroupRadio = driver.findElement(By.xpath("//label[@for='radio-redundancyzones']")); ServerGroupRadio.click(); } searchByIdAndClick(gridIcon); WebElement TreeMapMember = driver.findElement(By.xpath("//div[@id='" + S1 + "M" + (i) + "']/div")); Actions builder = new Actions(driver); builder.clickAndHold(TreeMapMember).perform(); int j = 1; String CPUUsageM1temp = driver .findElement(By.xpath("//div[@id='_tooltip']/div/div/div[2]/div/div[2]/div")) .getText(); String CPUUsageM1 = CPUUsageM1temp.replaceAll("[\\%]", ""); String cpuUsageM1 = JMXProperties.getInstance().getProperty("member.M" + (i) + ".cpuUsage"); Assert.assertEquals(cpuUsageM1, CPUUsageM1); String MemoryUsageM1temp = driver .findElement( By.xpath("//div[@id='_tooltip']/div/div/div[2]/div[" + (j + 1) + "]/div[2]/div")) .getText(); String MemoryUsageM1 = MemoryUsageM1temp.replaceAll("MB", ""); String memoryUsageM1 = JMXProperties.getInstance().getProperty("member.M" + (i) + ".UsedMemory"); Assert.assertEquals(memoryUsageM1, MemoryUsageM1); String LoadAvgM1 = driver .findElement( By.xpath("//div[@id='_tooltip']/div/div/div[2]/div[" + (j + 2) + "]/div[2]/div")) .getText(); String loadAvgM1 = JMXProperties.getInstance().getProperty("member.M" + (i) + ".loadAverage"); Assert.assertEquals(df2.format(Double.valueOf(loadAvgM1)), LoadAvgM1); String ThreadsM1 = driver .findElement( By.xpath("//div[@id='_tooltip']/div/div/div[2]/div[" + (j + 3) + "]/div[2]/div")) .getText(); String threadsM1 = JMXProperties.getInstance().getProperty("member.M" + (i) + ".numThreads"); Assert.assertEquals(threadsM1, ThreadsM1); String SocketsM1 = driver .findElement( By.xpath("//div[@id='_tooltip']/div/div/div[2]/div[" + (j + 4) + "]/div[2]/div")) .getText(); String socketsM1 = JMXProperties.getInstance().getProperty("member.M" + (i) + ".totalFileDescriptorOpen"); Assert.assertEquals(socketsM1, SocketsM1); builder.moveToElement(TreeMapMember).release().perform(); } }