Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Selenium和Java定位元素_Java_Selenium Webdriver_Xpath_Css Selectors_Selenide - Fatal编程技术网

如何使用Selenium和Java定位元素

如何使用Selenium和Java定位元素,java,selenium-webdriver,xpath,css-selectors,selenide,Java,Selenium Webdriver,Xpath,Css Selectors,Selenide,请帮我找到这里的xpath/css选择器是什么?我需要使用selenide中的定位器来定位该元素,所需元素是一个元素,因此您需要引导WebDriverWait以使所需元素可单击,并且您可以使用以下任一选项: css选择器: <input class="chkbx-selection ng-pristine ng-untouched ng-valid" type="checkbox" value="test" id="isAgreeChkBox" ng-model="$root.isAgr

请帮我找到这里的xpath/css选择器是什么?我需要使用selenide中的定位器来定位该元素,所需元素是一个元素,因此您需要引导WebDriverWait以使所需元素可单击,并且您可以使用以下任一选项:

  • css选择器

    <input class="chkbx-selection ng-pristine ng-untouched ng-valid" type="checkbox" value="test" id="isAgreeChkBox" ng-model="$root.isAgreement">
    
  • xpath

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input.chkbx-selection.ng-pristine.ng-untouched.ng-valid#isAgreeChkBox[value='test']"))).click();
    

什么元素。。。?请编辑问题<代码>驱动程序.findElement(By.Id(“isagerichkbox”)
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();