Hola
Tengo el problema que quiero poder manipular el reCaptcha v2 usando Selenium pero no logro hacer clic en un elemento dentro.
Mi código:
new WebDriverWait(driver, 20).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[starts-with(@name, 'a-') and starts-with(@src, 'https://www.google.com/recaptcha')]")));
new WebDriverWait(driver, 30).until(ExpectedConditions.elementToBeClickable(By.cssSelector("div.rc-anchor-content"))).click();
new WebDriverWait(driver, 20).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[starts-with(@name, 'c-') and starts-with(@src, 'https://www.google.com/recaptcha')]")));
new WebDriverWait(driver, 30).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"recaptcha-reload-button\"]"))).click();
Mi código logra encontrar el Captcha y hacer clic y en teoría debería poder encontrar el otro iframe donde se muestran las opciones e imágenes. Pero no lo obtiene y por lo tanto no puede hacer clic en el botón reload.
El error presente en consola:
*** Element info: {Using=xpath, value=//iframe[starts-with(@name, 'c-') and starts-with(@src, 'https://www.google.com/recaptcha')]} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323) at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428) at org.openqa.selenium.By$ByXPath.findElement(By.java:353) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315) at org.openqa.selenium.support.ui.ExpectedConditions$17.apply(ExpectedConditions.java:501) at org.openqa.selenium.support.ui.ExpectedConditions$17.apply(ExpectedConditions.java:497) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249) ... 36 more console.error: "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers."