Selenium C#:将元素在图表上的位置存储为变量

时间:2015-06-08 20:51:38

标签: c# selenium selenium-webdriver

enter image description here

我想将此图表中圆圈的位置存储为变量,因此我可以将其与保存在数据库中的位置进行比较。

<circle class="" ng-touch="manualGraph($event, c, 'left')" ng-mousedown="manualGraph($event
, c,'left')" ng-show="audiogram.leftEnabled && manual" ng-repeat="c in audiogram.tonePoints
| filter: {'resultSet': 'left'} | orderBy : 'stimulusFrequency'" fill="black" ep-r="8" ep-c
y="146.1820459269123" ep-cx="42" cy="146.1820459269123" cx="42" r="8">

我想存储的值是上面的ep-cy或cy。

我目前使用下面的索引与圈子互动:

var circles = Driver.Instance.FindElements(By.TagName("circle"));
var circle = circles[circleIndex];

1 个答案:

答案 0 :(得分:1)

假设您已经按照说明找到了您的圈子元素,那么您应该可以这样做:

string position = circle.GetAttribute("cy");