Today marks my debut using Selenium IDE, and I must admit that my knowledge of web development is limited. My team is currently working on a website, and as part of my task, I need to write tests for it. The website features several charts showcasing data we've collected. My goal is to search for specific words within each chart to determine if they are accurate and identify any discrepancies.
However, I'm facing a challenge in accessing each "chart object" individually. When I use the command:
verifyTextPresent, target =, value = Good value
The command works fine (appears green in Selenium IDE) when one of the six charts displays "Good value" correctly. I believe it searches the entire webpage, which explains why it's successful. But when I attempt to test each chart separately, I encounter difficulties.
Here are some strategies I've experimented with:
1) I tried right-clicking on the chart object, and Selenium IDE identified the target as:
css=svg > rect
Despite this, the operation consistently fails, with the log showing:
[error] Element css=svg > rect not found
2) I visited http://docs.seleniumhq.org/docs/02_selenium_ide.jsp#locating-elements to gather insights. Unfortunately, the examples provided didn't align entirely with our setup, so my attempts were somewhat random and ineffective. While I'll include the source HTML below for context, here are some other methods I tried:
id=numRecs
identifier=charts-6
css=class#charts-container//chart-6
A thorough search indicates that these values are unique, reducing the potential for parsing errors.
Below is an excerpt from Chrome displaying partial source for the chart object. More information can be supplied upon request, but these snippets appear crucial – hovering over these div elements highlights the corresponding chart:
<body>
blah blah
<div id="numRecs" data-chart="3">
<div class="charts-container" id="charts-6" style="position: relative; overflow: hidden; width: 1267px; height: 300px; text-align: left; line-height: normal; z-index: 0; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif; font-size: 12px;">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1267" height="300">
blah blah
<div id="another chart" data-chart="4">
blah blah
</div>
<div id="misc chart" data-chart="5">
blah blah
</div>
</body>
I am hopeful someone can steer me in the right direction. Thank you in advance for your assistance.