I have an application, on the login page of an application I have a username, password captcha, and log in. When I fill in username, password and click on captcha it's working fine but when I click on login it not working. Please check the screenshot: https://prnt.sc/1qhua85 Page Link: https://sell360d.allomate.solutions/login My code:
WebDriverWait wait = new WebDriverWait (driver, 10);
WebElement username = wait.until(ExpectedConditions.elementToBeClickable(By.id("exampleInputEmail_2")));
username.sendKeys("username");
WebElement password = wait.until(ExpectedConditions.elementToBeClickable(By.id("exampleInputpwd_2")));
password.sendKeys("password");
WebElement captcha = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/app-root/div/div/div[1]/app-login-component/div/div/div/div/div/div/div/form/div[3]/div/re-captcha/div/div/iframe")));
captcha.click();
WebElement login = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/app-root/div/div/div[1]/app-login-component/div/div/div/div/div/div/div/form/div[4]/button")));
login.click();
The thing is captcha is in iframe, and login button is not.
also try to put some hardcoded sleep, cause explicit wait does not seems to be working:
WebDriverWait wait = new WebDriverWait (driver, 10);
WebElement username = wait.until(ExpectedConditions.elementToBeClickable(By.id("exampleInputEmail_2")));
username.sendKeys("username");
WebElement password = wait.until(ExpectedConditions.elementToBeClickable(By.id("exampleInputpwd_2")));
password.sendKeys("password");
WebElement captcha = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/app-root/div/div/div[1]/app-login-component/div/div/div/div/div/div/div/form/div[3]/div/re-captcha/div/div/iframe")));
captcha.click();
Thread.sleep(5000);
WebElement login = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[contains(@class,'btn-login')]")));
login.click();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.