<input class="chkbx-selection ng-pristine ng-untouched ng-valid" type="checkbox" value="test" id="isAgreeChkBox" ng-model="$root.isAgreement">
请帮助我在这里找到什么是xpath / css选择器?我需要使用硒化物中的定位器来定位
答案 0 :(得分:0)
所需元素是Angular元素,因此您需要诱使 WebDriverWait 使所需元素可点击,并且您可以使用以下任一{ {3}}:
cssSelector
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input.chkbx-selection.ng-pristine.ng-untouched.ng-valid#isAgreeChkBox[value='test']"))).click();
xpath
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@class='chkbx-selection ng-pristine ng-untouched ng-valid' and @id='isAgreeChkBox'][@value='test']"))).click();