1

I am using selenium RC's getAttribute method to get the color of SVG element. The HTML code goes like this:

<div style="width: 600px; height: 350px;">
<svg overflow="hidden" width="600" height="350">
<defs/><circle fill="#F0F8F8" fill-opacity="1.0" stroke="black" stroke-opacity="1.0" stroke-width="1" r="120" cx="300" cy="175"/><circle fill="#00bb00" fill-opacity="1.0" stroke="black" stroke-opacity="1.0" stroke-width="1" r="30" cx="420" cy="175"/>
</svg></div>

The getAttribute method gives error as incorrect xpath.

I am using as below:

getAttribute("//table[@id='View$GraphPanel']//tbody/tr[2]/td/div//[local-name() = 'svg']//[name()='circle'][2]@fill")

Error:

2014-04-24 08:57:25.888 INFO - Command request: getAttribute[xpath=//table[@id='DashboardView$GraphPanel']//tbody/tr[2]/td/div//‌​[local-name() = 'svg']//[name()='circle'][2]@fill, ] on session 
2014-04-24 08:57:25.909 INFO - Got result: ERROR: Invalid xpath [2]: //table[@id='DashboardView$GraphPanel']//tbody/tr[2]/td/div//[local-name() = 'svg']//[name()='circle'][2] on session 
2014-04-24 08:57:25,910 [main]org.junit.internal.runners.statements.FailOnTimeout: callable terminated == true, isDone == true, isCancelled == false
Alexey Malev
  • 6,408
  • 4
  • 34
  • 52
user1140969
  • 105
  • 6
  • Please post information about the error you get. – Alexey Malev Apr 24 '14 at 12:19
  • Hi Alexey,below is the error ----------------- 2014-04-24 08:57:25.888 INFO - Command request: getAttribute[xpath=//table[@id='DashboardView$GraphPanel']//tbody/tr[2]/td/div//[local-name() = 'svg']//[name()='circle'][2]@fill, ] on session 2014-04-24 08:57:25.909 INFO - Got result: ERROR: Invalid xpath [2]: //table[@id='DashboardView$GraphPanel']//tbody/tr[2]/td/div//[local-name() = 'svg']//[name()='circle'][2] on session 2014-04-24 08:57:25,910 [main]org.junit.internal.runners.statements.FailOnTimeout: callable terminated == true, isDone == true, isCancelled == false ----------------- – user1140969 Apr 25 '14 at 05:54

0 Answers0