Hi I am looking to get Tool tips for this chart - Donut chart. I tried lot of variation to have tool tips but Its look like its coming from JavaScript so I am not able to get it.
1 Answer
I was able to get it using Chrome's Dev Tools. Here is how:
- Right-click on the blue section of the pie chart and select 'Inspect'
- Right-click on the highlighted element in the 'Elements' tab of DevTools
- Select
:hover
to apply the hover state - you'll see a new div is added below the SVG, something like
*...div class="amcharts-ballon-div"...*
- Expand the tree to find the element that contains the text
- Right-click on that element and select "Copy" > "Copy Selector"
- Test the selector in the Console tab of DevTools by doing
document.querySelector("paste_selector_here")
For me, document.querySelector("#chartdiv > div > div.amcharts-chart-div > div > div")
returned the element in question.
In a test remember to first do a Hover using the Actions class in the Selenium library.