I have this code with php-webdriver library in Selenium to click hCAPTCHA's checkbox square button but results to an error instead. See code below...
$driver = RemoteWebDriver::create($host, $capabilities);
$driver->get('https://accounts.hcaptcha.com/demo?sitekey=f5561ba9-8f1e-40ca-9b5b-a0b3f719ef34');
print ($driver->getTitle());
$iframe = $driver->findElement(WebDriverBy::xpath("/html/body/div[5]/form/fieldset/ul/li[2]/div/div/iframe"));
$driver->switchTo()->frame($iframe);
$checkbox = $driver->findElement(WebDriverBy::id('/html/body/div/div[1]/div[1]/div'));
$checkbox->click();
But results to an error below...
Fatal error: Uncaught Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"/html/body/div/div[1]/div[1]/div"}