How to pass value in input field i.e. Search box? I tried using cssSelector as:
element = driver.findElement(By.cssSelector("input[placeholder='Search for restaurants and food']"));
and using className as well.
Snapshot of the element:
How to pass value in input field i.e. Search box? I tried using cssSelector as:
element = driver.findElement(By.cssSelector("input[placeholder='Search for restaurants and food']"));
and using className as well.
Snapshot of the element:
To send a character sequence to the Search field within the Swiggy website you need to induce WebDriverWait for the elementToBeClickable() and you can use either of the following locator strategies:
cssSelector:
new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input[placeholder='Search for restaurants and food']"))).sendKeys("Pizza");
xpath:
new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@placeholder='Search for restaurants and food']"))).sendKeys("Pizza");