我試圖讓webdriver點擊文本「打破東西」通過xpath/css
選擇器無濟於事。下面是HTML硒webdriver:點擊不工作的xpath
<div class="org-option" ng-repeat="Org in Organizations" aria-label="Select Breaking Things Organization" ng-click="Org.SelectOrg()" role="button" tabindex="0">
<div class="data">
<div class="data-relative">
<!---->
<div class="image-wrapper" ng-show="Org.HasImage" ng-if="Org.HasImage" aria-hidden="false">
<img class="onboard-logo" ng-src="/apiimage/organizations/f1544944fac34442998a05890c400338-0" src="/apiimage/organizations/f1544944fac34442998a05890c400338-0">
</div>
<!---->
<div class="image-wrapper ng-hide" ng-show="!Org.HasImage" aria-hidden="true">
<div class="image-placeholder">
<div class="center-icon gicon-panorama"></div>
</div>
</div>
<div class="name-wrapper">
<div>Breaking Things</div>
下面是我在做什麼與司機:
chromeDriver.findElement(By.xpath("//div[@class='name wrapper']//[text()='Breaking Things']")).click();
但是它從來沒有點擊,我缺少什麼?我也嘗試過隱式等待而沒有結果。
噢噢,是的,你是對的 - 這是我手動輸入的。語法正確嗎?我試過幾種不同的類型,它會拋出無效的表達式錯誤: – potatocode