0

I'm loading data from an external file in Selenium IDE (2.9.1) & SelBlocks (2.1.1) with "forJson" function to interact with canvas - insert an object to exact coordinates. Selenium test works, but it seems like JSON data are not read and object is inserted to random coordinates.

JSON file example:

[
{
    "coords": {
        "x": 400,
        "y": 800
    }
}
]

Selenium test example:

<tr>
    <td>forJson</td>
    <td>testdata.json</td>
    <td></td>
</tr>
<tr>
    <td>clickAt</td>
    <td>css=canvas</td>
    <td></td>
</tr>
<tr>
    <td>endForJson</td>
    <td></td>
    <td></td>
</tr>

I have also tried "loadJsonVars" or "clickAt" with coords just like an interaction with Google maps - Clicking on Google Maps with Selenium IDE, but no luck.

Thanks in advance for any references or additional questions.

Community
  • 1
  • 1

1 Answers1

0

You're referencing the json file, but on your click command there is nothing there to tell the script to use the coordinates from the file. I use something similar and the way I'd have this example would be to have the json file formatted as:

[{x:"400",y:"800"}]

And then the selenium script would be:

<tr>
    <td>forJson</td>
    <td>testdata.json</td>
    <td></td>
</tr>
<tr>
    <td>clickAt</td>
    <td>css=canvas</td>
    <td>${x},${y}</td>
</tr>
<tr>
    <td>endForJson</td>
    <td></td>
    <td></td>
</tr>
Jsmith2800
  • 1,113
  • 1
  • 9
  • 18