无法使用Selenium WebDriver在Chrome浏览器中找到元素(findElement)

时间:2015-12-15 09:38:09

标签: selenium selenium-webdriver automated-tests selenium-ide qa

我无法在Chrome浏览器中找到元素(

  

纳克绑定="&了task.state#34;>文件与LT;

Selenium只能在FireFox浏览器中找到该元素(通过Selenium IDE)

 driver.findElement(By.xpath("//div[4]/span")).click();

HTML:



<div class="stat-column">
          <h4><!-- <div class="dashboard-tasks-undone">{{numTasks}}</div>  --> <span class="dashboard-tasks-undone-text">Tasks</span></h4>
          <div class="tasks-panel row">
            <!-- ngRepeat: task in tasks --><div class="col-xs-4 tasks-panel-cell ng-scope" ng-repeat="task in tasks" ng-click="kycTaskClick(task)">
              <span class="task-counter ng-binding task-counter-red" ng-bind="task.COUNT" ng-class="{'task-counter-faded': task.COUNT == '0','task-counter-red':task.red}">11</span>
              <span class="task-description ng-binding" ng-bind="task.STATE">Permission</span>
            </div><!-- end ngRepeat: task in tasks --><div class="col-xs-4 tasks-panel-cell ng-scope" ng-repeat="task in tasks" ng-click="kycTaskClick(task)">
              <span class="task-counter ng-binding" ng-bind="task.COUNT" ng-class="{'task-counter-faded': task.COUNT == '0','task-counter-red':task.red}">27</span>
              <span class="task-description ng-binding" ng-bind="task.STATE">Authorised</span>
            </div><!-- end ngRepeat: task in tasks --><div class="col-xs-4 tasks-panel-cell ng-scope" ng-repeat="task in tasks" ng-click="kycTaskClick(task)">
              <span class="task-counter ng-binding" ng-bind="task.COUNT" ng-class="{'task-counter-faded': task.COUNT == '0','task-counter-red':task.red}">95</span>
              <span class="task-description ng-binding" ng-bind="task.STATE">Answers</span>
            </div><!-- end ngRepeat: task in tasks --><div class="col-xs-4 tasks-panel-cell ng-scope" ng-repeat="task in tasks" ng-click="kycTaskClick(task)">
              <span class="task-counter ng-binding" ng-bind="task.COUNT" ng-class="{'task-counter-faded': task.COUNT == '0','task-counter-red':task.red}">47</span>
              <span class="task-description ng-binding" ng-bind="task.STATE">Documents</span>
            </div><!-- end ngRepeat: task in tasks --><div class="col-xs-4 tasks-panel-cell ng-scope" ng-repeat="task in tasks" ng-click="kycTaskClick(task)">
              <span class="task-counter ng-binding" ng-bind="task.COUNT" ng-class="{'task-counter-faded': task.COUNT == '0','task-counter-red':task.red}">14</span>
              <span class="task-description ng-binding" ng-bind="task.STATE">Identity</span>
            </div><!-- end ngRepeat: task in tasks --><div class="col-xs-4 
          </div>
        </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

你可以在xpaths下面试试

//跨度[含有(文本(), '文件')]

// DIV [@类= 'STAT-柱'] / DIV / DIV [4] /跨度[2]

// DIV [@类= 'STAT-柱'] / DIV / DIV [4] /跨度[@纳克绑定= '了task.state']

还有更多可能......

由于