【发布时间】:2020-02-29 19:19:42
【问题描述】:
我在定位正确的 Xpath/ID 输入字段时遇到问题,我以以下网站为例:
https://garden.lovetoknow.com/vegetable-garden/how-ripen-green-tomatoes-off-vine
打开链接后向下滚动一点,你会看到“写评论”蓝色按钮,点击它然后填写文本和名称,它会出现一个reCaptcha example,我尝试了以下方式点击复选框,但没有成功。如果有人可以帮我解决一下,我将不胜感激
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath(
"//iframe[starts-with(@name, 'a-') and starts-with(@src, 'https://www.google.com/recaptcha')]")));
new WebDriverWait(driver, 10)
.until(ExpectedConditions.elementToBeClickable(By.cssSelector("div.recaptcha-checkbox-checkmark"))).click();
【问题讨论】:
标签: java selenium-webdriver recaptcha