我尝试了下面的代码来单击下拉列表:
driver.FindElement(By.XPath("//div[@id='content']/div/app-appdashboard/div[3]/div/div/div/div/button")).Click();
我尝试使用以下代码单击下拉列表中的选项之一:
司机。FindElement(By.XPath("//div[@id='cdk-overlay-0']/div/div/button[16]/span"((.点击((;
<button _ngcontent-jco-c9="" aria-haspopup="true" class="btn btn-state dropdown-toggle" mat-button="" ng-reflect-menu="[object Object]">
<span _ngcontent-jco-c9="" class="ng-star-inserted"> Update Overall App Status </span></button>
<button _ngcontent-jco-c9="" aria-label="option row button." class="menu-button mat-menu-item ng-star-inserted" mat-menu-item="" role="button" tabindex="0" ng-reflect-role="button" name="PM Supervisor Approved" title="PM Supervisor Approved" aria-disabled="false"><span _ngcontent-jco-c9="">PM Supervisor Approved</span><div class="mat-menu-ripple mat-ripple" matripple="" ng-reflect-disabled="false" ng-reflect-trigger="[object HTMLButtonElement]"></div></button>
试试这个:
WebDriverWait wait=new WebDriverWait(driver, 20);
driver.FindElement(By.className("ng-star-inserted")).click();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//button[@name='PM Supervisor Approved']/span")));
driver.FindElement(By.xpath(".//button[@name='PM Supervisor Approved']/span")).click();