Testing charts and graphs

Hi,

How can we test charts like pie chart, bar chart and graphs using webdriver.

Any idea.

Thanks,
Vishal

Doctor Asked on August 13, 2014 in Selenium WebDriver.
Add Comment
  • 3 Answer(s)

    I am posting the most basic but fundamental example for your Pie chart problem, Here I am taking Yahoo’s YUI based PIE Chart for my example. Here in each refresh all the sections are created dynamically so I am using contains in the id of the element . Here in the chart the controls are not simple HTML but these are svg (HTML5 controls) so on finding these we need to use //* in xpath.

    My motive here is to find these dynamic sections in the PIE chart(Here in the current chart there are 5 sections)

    And to click each section and to print tool tip text of these.

    The Out put will be like. Violette Part:day: Monday taxes: 2000

    Grey Part:day: Friday taxes: 2000

    Light Violette Part:day: Thursday taxes: 200

    Green Part:day: Wednesday taxes: 4000

    Brown Part:day: Tuesday taxes: 50 0.61%

    Here is the Demo program for it,anywhere you can execute it… 🙂 I have attached it as an image.

    RE: Testing charts and graphs

    Regards,
    Vaidy

    Doctor Answered on August 13, 2014.
    Add Comment

    Hey Vaidy,

    Can you please attach the code or give it in a more readable format?

    Thanks.
    Vishal.

    Doctor Answered on August 13, 2014.
    Add Comment

    Now look at it. I think this will be more comfortable for you.

     

     

    Regards,
    Vaidy

    Doctor Answered on August 13, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.