c# selenium chrome-webdrive 写入正确路径

c# selenium chrome-webdrive write correct path

您好,我只想使用 selenium chromedriver 创建一个用于在我的 stie 上单击按钮的路径。 html 块代码如下所示:

<tr ng-repeat="row in rowCollection" ng-class="{ &quot;error-row&quot;: row.errorMessage }" ng-style="vm.getColor(row)" class="ng-scope" style="background: rgb(255, 242, 255) none repeat scroll 0% 0%;">
    <td class="ng-binding">Wylaczenie nadan RDF</td><td class="ng-binding">WAITING_FOR_NOTIFICATION</td>
    <td>
        <a href="" ng-click="vm.showProcessDiagram(row.executor)" class="ng-binding">rfsSendingExecutor</a>
    </td>
    <td class="ng-binding">2017-09-06 11:14:12</td><td class="ng-binding">2017-09-06 11:14:13</td>
    <td has-role="REQUEST" class="text-center">
    <!-- ngIf: row.inXml || row.outXml -->
    <button ng-if="row.inXml || row.outXml" ng-click="vm.showXml(row)" title="Show" class="btn btn-xs ng-scope"><span class="fa fa-code"></span></button>
    <!-- end ngIf: row.inXml || row.outXml -->
    </td>
    <td has-role="ERROR" class="text-center"><button ng-show="row.errorMessage" ng-click="vm.showError(row.errorMessage)" title="Show" class="btn btn-xs ng-hide"><span class="fa fa-search"></span></button></td>
    <td class="text-center">
    <button ng-show="vm.enableCancel(row)" ng-click="vm.cancelTask(row.workItemId)" title="Cancel" class="btn btn-xs ng-hide">
        <span class="fa fa-ban text-warning"></span>
    </button> 
    <button ng-show="vm.enableRepeat(row)" ng-click="vm.repeatTask(row.id)" title="Repeat" class="btn btn-xs ng-hide">
        <span class="fa fa-refresh text-success"></span>
    </button> 
    <button ng-show="vm.enableRepeat(row)" ng-click="vm.repeatTaskWithParams(row.id)" title="Repeat with parameters" class="btn btn-xs ng-hide">
        <span class="fa fa-refresh text-warning"></span>
    </button>
    <button ng-show="vm.enableSkip(row)" ng-click="vm.skipTask(row.workItemId)" title="Skip" class="btn btn-xs">
        <span class="fa fa-angle-double-right text-success"></span>
    </button>
    </td>
</tr>

我只想点击这个按钮 :

<button ng-show="vm.enableSkip(row)" ng-click="vm.skipTask(row.workItemId)" title="Skip" class="btn btn-xs">
        <span class="fa fa-angle-double-right text-success"></span>

我尝试这样的事情: 这很好用,点击我的按钮:

 drive.FindElement(By.XPath($"//tr[td='Wylaczenie nadan RDF']//button[@title='Skip']")).Click();

但我所需要的只是向这条路径添加另一个值。 它应该是这样的: Wylaczenie nadan RDFWAITING_FOR_NOTIFICATIONrfsSendingExecutor 最后当此路径正确时单击按钮。

我尝试这样的事情:

 drive.FindElement(By.XPath($"//tr[td='Wylaczenie nadan RDF'] AND tr[td='WAITING_FOR_NOTIFICATION'] AND tr[td='rfsSendingExecutor']//button[@title='Skip']")).Click();

但这不起作用。有人可以帮我写更正这条路吗?

这适用于 HTML 提供的

By.XPath("//tr[td='Wylaczenie nadan RDF'][td='WAITING_FOR_NOTIFICATION'][td/a='rfsSendingExecutor']//button[@title='Skip']")