My code:

public class Test {

  public  void main(String[] args) throws Exception {

    System.setProperty("webdriver.chrome.driver", "****************");

    WebDriver driver = new ChromeDriver();

    driver.manage().window().maximize();

    driver.get("**************");

    driver.manage().window().maximize();

    driver.findElement(By.xpath(".//label[text()='Create A Profile']")).click();

    driver.findElement(By.xpath("..//div[@class='-input']/input[@id='Module--Captcha-input-78189cbe4512de369a72d22c7050fbec0ea3f5cb86f351bafbb344df0f04508deebb23aa6f910098a68acaace3eb00ab' ]")).sendKeys("000");

  }

}

The html

<div class="captcha-input"> 
    <label class="form-label block required" for="Module-Captcha-Captcha-input-78189cbe4512de369a72d22c7050fbec0ea3f5cb86f351bafbb344df0f04508deebb23aa6f910098a68acaace3eb00ab"> 
    <input id="Module-Captcha-Captcha-input-78189cbe4512de369a72d22c7050fbec0ea3f5cb86f351bafbb344df0f04508deebb23aa6f910098a68acaace3eb00ab" class="full-width narrow Component-Form-Validation-Validation field" name="captcha.captchaSolution" data-validation-error="" data-validation-message="Please enter the correct captcha " aria-required="true" required="required" type="text"/> 
</div>

I get the error no such element: Unable to locate element on the last code statement.



Source link https://sqa.stackexchange.com/questions/35491/is-possible-to--captcha-in--if-the-captcha-is-a-static-one

LEAVE A REPLY

Please enter your comment!
Please enter your name here