Reading Pie Chart Tool Tip Value In Selenium WebDriver Test

Many spider web applications contains charts to exhibit dissimilar information In nautical chart view. One of the nautical chart they are using Is Pie chart. It Is really Important for us to know how to automate these pie charts In selenium WebDriver test. Few of the charts are really slow to automate but It Is really difficult to automate only about charts every bit nosotros are unable to locate parts of pie chart.

Here Is unproblematic event to exceed away tool tip value from pie chart. It volition click on dissimilar parts of pie nautical chart in addition to exceed away the tool tip values.


package Testing_Pack;  import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;  world shape pieChart {    WebDriver driver;    @BeforeTest  world void setup() throws Exception {   driver = novel FirefoxDriver();   driver.manage().window().maximize();   driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);   driver.get("http://yuilibrary.com/yui/docs/charts/charts-pie.html");  }    @Test  world void pieChart(){   //Locate pie nautical chart elements based on dissimilar colors.   WebElement VioleteColor = driver.findElement(By.xpath("//*[contains(@class,'yui3-svgSvgPieSlice')][@fill='#66007f']"));   WebElement GreenColor = driver.findElement(By.xpath("//*[contains(@class,'yui3-svgSvgPieSlice')][@fill='#295454']"));   WebElement GreyColor = driver.findElement(By.xpath("//*[contains(@class,'yui3-svgSvgPieSlice')][@fill='#e8cdb7']"));   WebElement LightVioleteColor = driver.findElement(By.xpath("//*[contains(@class,'yui3-svgSvgPieSlice')][@fill='#996ab2']"));   WebElement BrownColor = driver.findElement(By.xpath("//*[contains(@class,'yui3-svgSvgPieSlice')][@fill='#a86f41']"));      //locate tooltip pie chart.   WebElement ToolTip = driver.findElement(By.xpath("//div[contains(@id,'_tooltip')]"));    //Click on pie nautical chart parts in addition to exceed away tooltip values.   System.out.println("-X-X-X-X-X-X-X-X- Violete Part -X-X-X-X-X-X-X-X-");   VioleteColor.click();     System.out.println(ToolTip.getText());   System.out.println();        System.out.println("-X-X-X-X-X-X-X-X- Grey Part -X-X-X-X-X-X-X-X-");   GreyColor.click();   System.out.println(ToolTip.getText());   System.out.println();      System.out.println("-X-X-X-X-X-X-X-X- Light Violete Part -X-X-X-X-X-X-X-X-");   LightVioleteColor.click();   System.out.println(ToolTip.getText());   System.out.println();      System.out.println("-X-X-X-X-X-X-X-X- Green Part -X-X-X-X-X-X-X-X-");   GreenColor.click();   System.out.println(ToolTip.getText());   System.out.println();      System.out.println("-X-X-X-X-X-X-X-X- Brown Part -X-X-X-X-X-X-X-X-");   BrownColor.click();   System.out.println(ToolTip.getText());    } }

Run inwards a higher house event In eclipse in addition to verify console upshot on exam execution completion. It volition impress pie nautical chart tool tip values In console.
More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM 

http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post