/*1. selenium.mouseOver("//*[@id='mainnavigation']/div[1]/ul/li[1]/a");String myTitle = selenium.getAttribute("//*[@id='mainnavigation']/div[1]/ul/li[1]/a@title"); *//*2. OverviewTip = Globals.driver.findElement(By.xpath(Home_Page.divGroupchatTooltip)).getText();*//*3. String tooltip=wd.findElement(By.xpath(".//*[@id='highcharts-4']/svg/g[5]/g[2]/path[1]")).getAttribute("title");System.out.println(tooltip); *//*4. function isHidden(el) {var style = driver.getComputedStyle(el);return (style.display === 'none')}*//*5. if(getComputedStyle(elm).visibility === 'hidden') { return false; }*//*6. const style = getComputedStyle(driver);var style = driver.getComputedStyle(el);*//*7. var element = driver.getElementById("element");if(element.style.visibility == "hidden"){System.out.println();}*/
The default div with tooltip class does not contains data, you should click a dot in the chart and the tooltip will displayed and the element has the text. then, you can get it back.
BTW: the last email from me said the tooltip in the <text> element is not correct, for bubble chart, it is under a normal div>span>table.
--david
List <WebElement> shapes = driver.findElements((By.className("highcharts-container")));
The default div with tooltip class does not contains data, you should click a dot in the chart and the tooltip will displayed and the element has the text. then, you can get it back.
BTW: the last email from me said the tooltip in the <text> element is not correct, for bubble chart, it is under a normal div>span>table.
--david
From: seleniu...@googlegroups.com <seleniu...@googlegroups.com> on behalf of ama...@bufetedemarketing.com <ama...@bufetedemarketing.com>
Sent: Friday, May 12, 2017 3:08 PM
To: Selenium Users
Subject: [selenium-users] Get data from TOOLTIPS in highcharts
--Hi guys! I have the following highcharts point with tooltip:
I've written the following with Eclipse and Selenium Webdriver, but it doesn't appear the data inside the tooltip, why?
List <WebElement> shapes2 = driver.findElements((By.className("highcharts-tooltip"))); //this doesn't show any data from tooltipSystem.out.println();System.out.println("*** Array size to control 2: " +shapes2.size());java.util.Iterator<WebElement> k = shapes2.iterator();while(k.hasNext()) {WebElement row2 = k.next();System.out.println(row2.getText() + " ** ");}
Thanks so much for your help!!!!
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleni...@googlegroups.com.
Hi David!1. If I write the css of one point of the highcharts, I can't either get the data...List <WebElement> shapes = driver.findElements((By.cssSelector(".//*[@id='highcharts-4']/div[1]/span")));
2. I don't know how to put "<div>" to get data in a command... If I have this command:List <WebElement> shapes = driver.findElements((By.className("highcharts-container")));
***I've re-written the following with "<div>" but It doesn't work:
System.out.println(driver.findElement(By.xpath(".//*[@id='highcharts-4']/svg/g[5]/g[2]/path[1]")));System.out.println(driver.findElement(By.id("highcharts-4")).getAttribute("title"));System.out.println(driver.findElement(By.id("highcharts-4")).getAttribute("path"));System.out.println(driver.findElement(By.id("highcharts-4")).getAttribute("svg"));System.out.println(driver.findElement(By.id("highcharts-4")).getText());System.out.println(driver.findElement(By.id("highcharts-4")).getCssValue("div.highcharts-tooltip"));System.out.println(driver.findElement(By.id("highcharts-4")).getCssValue("div.highcharts-tooltip"));System.out.println(driver.findElement(By.className("div.highcharts-tooltip")).getText());System.out.println(driver.findElement(By.cssSelector("div.highcharts-tooltip")).getText());System.out.println(driver.findElement(By.className("highcharts-series")).getText());System.out.println(driver.findElement(By.className("highcharts-series-group")).getText());System.out.println(driver.findElement(By.className("highcharts-tracker")).getText());System.out.println(driver.findElement(By.className("highcharts-tooltip")).getText());System.out.println(driver.findElement(By.cssSelector("div.highcharts-tracker")).getText());System.out.println(driver.findElement(By.cssSelector("div.highcharts-series-group")).getText());System.out.println(driver.findElement(By.cssSelector("div.highcharts-4.highcharts-container")).getText());
System.out.println(driver.findElement(By.className("highcharts-legend-item")).getText());
System.out.println(driver.findElement(By.id("highcharts-4")).getAttribute("rect"));System.out.println(driver.findElement(By.xpath(".//*[@id='highcharts-4']/svg/g[5]/g[2]/path[2]")).getText());System.out.println(driver.findElement(By.xpath(".//*[@id='highcharts-4']/svg/g[5]/g[2]/path[3]")));System.out.println(driver.findElement(By.xpath(".//*[@id='highcharts-4']/svg/g[5]/g[2]/path[7]")));System.out.println(driver.findElement(By.xpath(".//*[@id='highcharts-4']/div[1]/span")));System.out.println(driver.findElement(By.xpath(".//*[@id='highcharts-4']/svg/rect")));System.out.println(driver.findElement(By.className("highcharts-series")).getAttribute("rect"));
I've found the following useful web page to verify tooltips from Selenium Webdriver: http://www.seleniumeasy.com/selenium-tutorials/how-to-verify-tooltip-text-with-selenium-webdriver-using-javaBut I don't know to identify my "boxElement" where my tooltip is... I've tried with "highcharts-4", but it doesn't work.How could I re-write the following code with my case? (I attached some pictures showing the classes last week) If you could help me... I'll be vert grateful...Actions action = new Actions(driver); WebElement element = driver.findElement(By.id("boxElement")); actions.moveToElement(element).build().perform();
// Text box field, where we mouse hoverWebElement element = driver.findElement(By.id("highcharts-4"));// Use action class to mouse hover on Text box field
Actions action = new Actions(driver);
action.moveToElement(element).build().perform();WebElement toolTipElement = driver.findElement(By.cssSelector(".highcharts-tooltip"));// To get the tool tip text and assertString toolTipText = toolTipElement.getText();Assert.assertEquals("Prueba de verificación de tooltip.", toolTipText);
To post to this group, send email to seleni...@googlegroups.com.
Well... I've modify the following code, but still, it doesn't work (Selenium doesn't identify the xpath I tell him...I don't know why. This is the xpath of the dot)
WebElement element = driver.findElement(By.xpath(".//*[@id='highcharts-4']/div[1]/span"));// Use action class to mouse hover on dot highchartActions action = new Actions(driver);action.moveToElement(element).build().perform();WebElement toolTipElement = driver.findElement(By.className("highcharts-tooltip"));
System.out.println(toolTipElement.getAttribute("span")+" span");System.out.println(toolTipElement.getAttribute("b")+" b");System.out.println(toolTipElement.getAttribute("path")+" path");System.out.println(toolTipElement.getAttribute("svg")+" svg");System.out.println(toolTipElement.getAttribute("title")+" title");System.out.println(toolTipElement.getAttribute("target")+" target");System.out.println(toolTipElement.getAttribute("e")+" e");System.out.println(toolTipElement.getAttribute("parentNode")+" parentNode");System.out.println(toolTipElement.getAttribute("g")+" toolTipElement g");
g tagName
I think that the correct code would be the following, but however, it doesn't work for me and I don't know why Selenium doesn't find my xpath dot:
//dot of the highchart where I put my mouse to see the tooltip. Selenium Webdriver doesn't find it and it causes an error, it stops the execution hereWebElement element = driver.findElement(By.xpath(".//*[@id='highcharts-4']/svg/g[5]/g[2]/path[5]")); //dot's xpath// Use action class to mouse hover on the dotActions action = new Actions(driver);action.moveToElement(element).build().perform();WebElement toolTipElement = driver.findElement(By.xpath(".//*[@id='highcharts-4']/div[1]/span")); //xpath of the shown tooltip// To get the tool tip textString toolTipText = toolTipElement.getText();Thanks so much... :(
I've seen the following code that I don't know if it is something that could help me, so I ask you if it's something important to pay attention:
Thankssssssssssssss
First, this xpath towards an sub-element under the <svg>, xpath does not works well for this case. the alternative way is use the css to locate the dot.
second, moveto action may not trigger the tooltip displayed, an alternative way is use click action
third, the tooltip element is a span, an standard html element, you can use xpath or others to locate the element.
your code still try use xpath to locate dot element and use the moveto action, it is the reason why you can't get the expect result.
--david
I think that the correct code would be the following, but however, it doesn't work for me and I don't know why Selenium doesn't find my xpath dot:
To post to this group, send email to seleni...@googlegroups.com.
WebElement element = driver.findElement(By.cssSelector("div[id^='highcharts-4'] span.highcharts-tooltip")).getText();
I've tried this, but it doesn't work again...
WebElement element = driver.findElement(By.cssSelector("div[id^='highcharts-4'] span.highcharts-tooltip"));
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/wWK2hVviZno/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/fd5f936a-74fe-451c-b392-f10ff1d099db%40googlegroups.com.
Done! I click on the element and I got it!!!!!!!!!!
Thanks a lot guys!!!!!!!!!!!!
Solved at least!!!!!!!!!!!!!!!!!!!!! :)
Great. It is due to some special in Highcharts test. Not a good test scenario, but congratulation you get it work.
--david
Like you know… I have the
xpath Monika told me: .//*[@id='highcharts-4']/*[name()='svg']/*[name()='g'][5]/*[name()='g'][2]/*[name()='path'][3]
To navigate between dots (from path[1] to path[10]).
If I have the xpath of the tooltip as: .//*[@id='highcharts-4']/div[1]/span
How could I get the tooltip for the followings dots from [1] to [10] ?
I’ve tried to get data from tooltip of element number 4:
- .//*[@id='highcharts-4']/div[4]/span But it isn’t found
- .//*[@id='highcharts-4']/*[name()='div'][4]/*[name()='span'] It isn’t either found
What am I doing wrong?
Thanks so much!!!
Monika
For more options, visit <a href="https://groups.google.com/d/optout" rel="n
there is only one tooltip element in the DOM. You can click different dot to make the text in the tooltip changed. the XPATH you used to locate dot element should be changed as well.
Monika
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/f163582e-2515-40ea-b0cb-d60eeeb4da82%40googlegroups.com?utm_medium=email&utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/selenium-users/f163582e-2515-40ea-b0cb-d60eeeb4da82%40googlegroups.com?utm_medium\x3dema
Sorry for the inconveniences!!!
Thanks so much!!!
Monika
</di