我正在嘗試執行一個Cucumber測試,該測試可以單擊ng-select組件(下拉菜單),然后單擊該菜單的選項之一。我嘗試使用“ element(by.partialLinkText('Solid Community'))。click()”,其中“ Solid Community”是必須單擊的文本。我也嘗試過“ by.LinkedText”,但是沒有用。我不能使用“ by.id”或類似的名稱,因為菜單的選項沒有ID(整個下拉菜單都有一個ID)。這是代碼的一些相關部分:login.component.html:... <div style="margin-top: 10px;"> <ng-select class="login-select" id="login-select-menu" bindLabel="name" bindValue="loginUrl" placeholder="Select ID Provider" dropdownPosition="bottom" [items]="identityProviders" [(ngModel)]="selectedProviderUrl" style="width: 360px; height: 48px; margin-left: auto; margin-right: auto;"> <!-- DROPDOWN TEMPLATE --> <ng-template ng-option-tmp let-item="item"> <div style="height:40px; padding-top:10px; position: relative;"> <img [src]="item.image" style="float: left; height: 32px; width: 32px; margin-top:-5px;" /> <span style="float: left; margin-left: 10px;">{{ item.name }}</span> <div style="clear: both;"></div> </div> </ng-template> </ng-select> <input type="text" class="wide-text" *ngIf="selectedProviderUrl===null" placeholder="Enter WebID" style="margin-top:10px; padding: 12px 10px; width: 340px; height: 16px; display: block; margin-left: auto; margin-right: auto;" [(ngModel)]="customProviderUrl" /> <button class="wide-button" (click)="onLogin()" *ngIf="selectedProviderUrl !== undefined || customProviderUrl !== undefined" [disabled]="selectedProviderUrl===null && !customProviderUrl" style="margin-top:10px;">Go</button> </div>...
使用定位器找不到任何元素:作者(部分鏈接文本,Solid Community)
米琪卡哇伊
2021-04-26 15:10:03