List of usage examples for org.openqa.selenium By xpath
public static By xpath(String xpathExpression)
From source file:com.cengage.mindtap.keywords.DashBoardPageActions.java
public boolean verifyPerformanceScoresGreen() { waitTOSync();/*from w ww .ja v a2 s. c o m*/ String good = driver.findElement(By.xpath(".//*[@class='good']")).getCssValue("fill"); waitTOSync(); waitTOSync(); driver.findElement(By.xpath("(//*[@class='good'])[1]")).click(); String value = driver.findElement(By.xpath(".//*[@id='perfPopup-0']/div[2]/p/span")).getText(); System.out.println("value is (avg) " + value); int len = value.length(); String valueScore = value.substring(len - 4, len - 1); System.out.println("value1 " + valueScore); int scoreGreen = Integer.parseInt(valueScore); System.out.println("final value " + scoreGreen); if (scoreGreen >= 90) { good.equalsIgnoreCase("rgb(155, 202, 67)"); executeJavascript("document.getElementById('allScores').click();"); element("apphidebtn", "Progress").click(); waitTOSync(); waitTOSync(); return true; } else { return false; } }
From source file:com.cengage.mindtap.keywords.DashBoardPageActions.java
public boolean verifyPerformanceScoresYellow() { waitTOSync();/*w ww. ja v a 2 s.co m*/ String fair = driver.findElement(By.xpath(".//*[@class='fair']")).getCssValue("fill"); //driver.findElement(By.xpath("")).click(); clickOnElementUsingActionBuilder(element("YellowDot")); waitTOSync(); waitTOSync(); String valueY = driver.findElement(By.xpath(".//*[@id='perfPopup-1']/div[2]/p/span")).getText(); System.out.println("value is (avg) " + valueY); int len = valueY.length(); String valueScore = valueY.substring(len - 3, len - 1); System.out.println("value1 " + valueScore); int scoreYellow = Integer.parseInt(valueScore); System.out.println("final value " + scoreYellow); //driver.findElement(By.xpath(".//*[id='performanceChart']")).click(); if (scoreYellow >= 70 && scoreYellow <= 89) { fair.equalsIgnoreCase("rgb(240, 170, 48)"); executeJavascript("document.getElementById('allScores').click();"); element("apphidebtn", "Progress").click(); waitTOSync(); waitTOSync(); return true; } else { return false; } }
From source file:com.cengage.mindtap.keywords.DashBoardPageActions.java
public boolean verifyPerformanceScoresRed() { waitTOSync();//w ww . java2 s .c o m String fail = driver.findElement(By.xpath(".//*[@class='fail']")).getCssValue("fill"); driver.findElement(By.xpath("(//*[@class='fail'])[2]")).click(); waitTOSync(); waitTOSync(); String value = driver.findElement(By.xpath(".//*[@id='perfPopup-5']/div[2]/p/span")).getText(); System.out.println("value is (avg) " + value); int len = value.length(); String valueScore = value.substring(len - 3, len - 1); System.out.println("value1 " + valueScore); int score = Integer.parseInt(valueScore); System.out.println("final value " + score); if (score <= 69) { fail.equalsIgnoreCase("rgb(239, 0, 0)"); return true; } else { return false; } }
From source file:com.cengage.mindtap.keywords.DashBoardPageActions.java
public void verifyAccountIsDeleted() { element("myContent").click(); switchToDockIFrame();/* w ww . ja v a 2 s. c om*/ String head = element("mycontent_title").getText(); if (head.contains("Kaltura")) ; driver.findElement(By.xpath("//a[contains(@title,'Google Drive')]")).click(); switchToAppIFrame(); element("signIn_btn").click(); Assert.assertTrue(element("signIn_btn").isDisplayed(), "Sign in button not displaying "); }
From source file:com.cengage.mindtap.keywords.EvernotePageActions.java
public void AddNote(String note) { waitTOSync();/* www . j av a 2 s .c o m*/ element("AddNote").click(); Assert.assertTrue(element("Note_Title").isDisplayed(), "Title box is not present"); element("Note_Title").clear(); element("Note_Title").sendKeys(note); waitTOSync(); switchToDefaultContent(); switchToDockIFrame(); switchToFrame("tinymce_editor_area_ifr"); waitTOSync(); WebElement element = driver.findElement(By.id("tinymce")); System.out.println("Entering note description in text input"); element.sendKeys(Keys.CONTROL + "a"); element.sendKeys("Instructor created note description"); switchToDefaultContent(); switchToDockIFrame(); element("SaveNote_Button").click(); waitTOSync(); String addedNote_Title = driver.findElement(By.xpath(".//ul[@class='plain']/li[1]/a")).getText(); System.out.println(addedNote_Title); Assert.assertTrue(addedNote_Title.contains(note), "Note is not added"); }
From source file:com.cengage.mindtap.keywords.EvernotePageActions.java
public void sort() { element("TitleSort").click(); List<WebElement> li = driver.findElements(By.xpath(".//ul[@class='plain']/li/a")); System.out.println(li.get(0).getText()); Assert.assertTrue(li.get(0).getText().contains("Aphabet")); // Assert.assertTrue(li.get(2).getText().contains("Instructor")); ReportMsg.info("Sorting is working fine"); }
From source file:com.cengage.mindtap.keywords.EvernotePageActions.java
public void editNote() throws AWTException { waitTOSync();//www.ja v a 2 s .com waitTOSync(); element("editNote").click(); element("Note_Title").clear(); element("Note_Title").sendKeys("Instructor edited Note"); switchToDefaultContent(); switchToDockIFrame(); switchToFrame("tinymce_editor_area_ifr"); waitTOSync(); WebElement element = driver.findElement(By.id("tinymce")); driver.findElement(By.id("tinymce")).clear(); System.out.println("Editing note description in text input"); //element.sendKeys(Keys.CONTROL + "a"); element.sendKeys(Keys.CONTROL + "b"); element.sendKeys("bold edited"); element.sendKeys(Keys.CONTROL + "b"); element.sendKeys(Keys.ENTER); element.sendKeys(Keys.CONTROL + "i"); element.sendKeys("Italics edited"); element.sendKeys(Keys.ENTER); element.sendKeys(Keys.CONTROL + "i"); element.sendKeys("hyperlinked"); element.sendKeys(Keys.chord(Keys.SHIFT, Keys.HOME)); waitTOSync(); switchToDefaultContent(); switchToDockIFrame(); element("hyperlink").click(); windowHandle = driver.getWindowHandle(); ArrayList<String> tabs2 = new ArrayList<String>(driver.getWindowHandles()); driver.switchTo().window(tabs2.get(1)); element("linkBox").clear(); element("linkBox").sendKeys("http://google.com"); element("LinkInsert").click(); waitTOSync(); driver.switchTo().window(windowHandle); System.out.println("window switched"); switchToDefaultContent(); switchToDockIFrame(); switchToFrame("tinymce_editor_area_ifr"); waitTOSync(); waitTOSync(); waitTOSync(); waitTOSync(); waitTOSync(); waitTOSync(); Assert.assertTrue(element("linkedText").isDisplayed(), "text is not linked"); switchToDefaultContent(); switchToDockIFrame(); element("updateNode_Button").click(); waitTOSync(); String addedNote_Title = driver.findElement(By.xpath(".//ul[@class='plain']/li[1]/a")).getText(); System.out.println(addedNote_Title); Assert.assertTrue(addedNote_Title.contains("edited Note"), "edited note is not displayed"); WebElement bold = driver.findElement(By.xpath("//strong[contains(text(),'bold edited')]")); Assert.assertTrue(bold.isDisplayed(), "bold text does not appear"); WebElement italics = driver.findElement(By.xpath("//em[contains(text(),'Italics edited')]")); Assert.assertTrue(italics.isDisplayed(), "italics text does not appear"); ReportMsg.info("Instructor successfuly edited note"); }
From source file:com.cengage.mindtap.keywords.EvernotePageActions.java
public void deleteNote() { List<WebElement> li = driver.findElements(By.xpath("//ul[@class='plain']/li/a")); System.out.println(li.size()); for (int i = 0; i < li.size(); i++) { clickOnElementUsingActionBuilder(element("delete_Note")); switchToDefaultContent();//from w ww .j ava 2 s.c om waitTOSync(); handleAlert(); //driver.switchTo().alert().accept(); switchToDockIFrame(); } }
From source file:com.cengage.mindtap.keywords.GoogleDriveAppPageActions.java
void checkAndUncheckShowAllContent() { // driver.switchTo().frame(dockFrame) //driver.switchTo().frame(appFrame) switchToDockIFrame();//from w w w .ja v a2 s .co m switchToAppIFrame(); element("showDoc").click(); Assert.assertTrue( driver.findElement(By.xpath(" //tr[contains(@class,'googledocument')]//a[@class='ng-binding']")) .isDisplayed(), "document is not shared"); deselectFrame(); }
From source file:com.cengage.mindtap.keywords.GoogleDriveAppPageActions.java
public void signInGoogleDrive(String gmailID, String password) { windowHandle = driver.getWindowHandle(); for (String handle : driver.getWindowHandles()) { driver.switchTo().window(handle); }/* w ww. ja v a2s . c o m*/ loginToGoogleAccount(gmailID, password); verifyGrantAccessInGoogleDoc(); driver.switchTo().window(windowHandle); //driver.switchTo().window(currentWindowHandle); Assert.assertTrue(driver.findElement(By.xpath(".//*[@id='picker:ht']")).isDisplayed()); driver.findElement(By.xpath("(//span[text()='analytics.html'])[1]")).click(); driver.findElement(By.xpath("//div[text()='Select' and @tabindex='0']")).click(); }