0

My problem is that I can't draw a polyline on Google Maps using Selenium. Here is my sample selenium script:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost:8080/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td><url link></td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[@id='map']/div/div/div[3]/div[3]/div</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[@id='map']/div/div/div[3]/div[3]/div</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=div[title=&quot;Draw a shape&quot;] &gt; span &gt; div &gt; img</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[@id='map']/div/div/div[3]/div[3]/div[15]</td>
    <td>400,300</td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[@id='map']/div/div/div[3]/div[3]/div[15]</td>
    <td>27195,14737</td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[@id='map']/div/div/div[3]/div[3]/div[15]</td>
    <td>27267,14801</td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[@id='map']/div/div/div[3]/div[3]/div[15]</td>
    <td>27287,14681</td>
</tr>
</tbody></table>
</body>
</html>

Values from the click actions are my lat-long coordinates for my polyline points to make a triangle shape. It is converted to pixel coordinates.

When the test case is played in Selenium it will zoom in to the map at 2x and then click the polyline tool (these steps are running ok).

But what to do after that - the coordinates from where I should draw the shape -- is my problem. It only clicks on the same spot and not even from where I was clicking it. From the recording it clicks on another location.

4
  • This is Selenium IDE not WebDriver.
    – JeffC
    Sep 23, 2015 at 1:35
  • Ooops. Sorry for that. Sep 23, 2015 at 1:40
  • np... I switched the tags and corrected the title.
    – JeffC
    Sep 23, 2015 at 1:44
  • 1
    Thanks for that. Just a newbie in selenium here. Thanks again for the corrections. Sep 23, 2015 at 1:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.