I'm using Java, Selenium, and chrome for test automation.
I want to enter a text, wait for it to be displayed and then click on TAB, I want to avoid thread.sleep
so i'm using this code :
WebElement societe = wait.until(ExpectedConditions.elementToBeClickable(By.id("AutoComplInputBoxfld_XSociete")));
societe.sendKeys("Text");
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
societe.sendKeys(Keys.TAB);
But it leave the field blank and goes to the next element.
- How can i fix it?
- Is there a way to use explicit wait before sendkeys?
Try this
Reference
https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#textToBePresentInElement-org.openqa.selenium.WebElement-java.lang.String-
Or
You can try
Ps-ignore formatting using device