From text boxI have tried many methods to find out the solution but I failed, So please help me regarding this Query
Website:- https://www.goibibo.com/
Inside th
You can use below code and instead of sending value hardcoded you can read it through Excel for dynamic.
import java.awt.AWTException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class Testing {
public static WebDriver driver;
@Test
public void test() throws InterruptedException, AWTException {
System.setProperty("webdriver.chrome.driver", "./Driver/chromedriver");
driver = new ChromeDriver();
driver.get("https://www.goibibo.com/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);
WebElement fromDropDwon = driver.findElement(By.xpath("//input[@id='gosuggest_inputSrc']"));
fromDropDwon.click();
fromDropDwon.sendKeys("Delhi (DEL)");
fromDropDwon.sendKeys(Keys.ARROW_DOWN);
fromDropDwon.sendKeys(Keys.ENTER);
}
}
Kindly upvote and it matches your expectation.