I am trying to automate search functionality in Goibobo web.(https://www.goibibo.com). For Departure we need to select a date. I used Javascript Executor Set Attribute for this. Value of Attribute is updated in DOM using Set Attribute, but GUI is not updated with the updated Value. So when I click on Search, it says, please select a departure date. Can anyone help me in this.
Here is the code I have show far - `
System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
WebDriver driver =new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://www.goibibo.com/");
driver.findElement(By.xpath("//input[@id='gosuggest_inputSrc']")).sendKeys("Madurai (IXM)");
Thread.sleep(1000);
driver.findElement(By.xpath("//input[@id='gosuggest_inputSrc']")).sendKeys(Keys.ARROW_DOWN);
Thread.sleep(1000);
driver.findElement(By.xpath("//input[@id='gosuggest_inputSrc']")).sendKeys(Keys.ENTER);
Thread.sleep(5000);
driver.findElement(By.xpath("//input[@id='gosuggest_inputDest']")).sendKeys("Chennai (MAA)");
Thread.sleep(1000);
driver.findElement(By.xpath("//input[@id='gosuggest_inputDest']")).sendKeys(Keys.ARROW_DOWN);
Thread.sleep(1000);
driver.findElement(By.xpath("//input[@id='gosuggest_inputDest']")).sendKeys(Keys.ENTER);
Thread.sleep(5000);
WebElement when = driver.findElement(By.xpath("//input[@placeholder ='Departure']"));
JavascriptExecutor js = (JavascriptExecutor)driver;
System.out.println("running javascript");
js.executeScript("arguments[0].setAttribute('value','Tue, 2 Jul')", driver.findElement(By.xpath("//input[@placeholder ='Departure']")));
//js.executeAsyncScript("arguments[0].setAttribute('value','Tue, 2 Jul')", driver.findElement(By.xpath("//input[@placeholder ='Departure']")));
Thread.sleep(5000);
System.out.println("ran");
driver.findElement(By.xpath("//button[@value='Search']")).click();
System.out.println("clicked on search");`
Thanks,
Karthik
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c2175616-d719-4786-9bac-06a1f78cee4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5847b9f3-f2ba-4aa1-aa91-2896cc09b04e%40googlegroups.com.