Here,I want to get the page content of all ajax events like in the mentioned website when we mouse hover on menu ajax calls are happening and then list of categories are displayed.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "E:\\phantomjs-2.0.0-windows\\bin\\phantomjs.exe");
WebDriver driver = new PhantomJSDriver(caps);
Actions actions = new Actions(driver);
WebElement menu= driver.findElement(By.xpath("//*[@id='navGroup1']/h1/a"));
actions.moveToElement(menu).click().build().perform();
Thread.sleep(50000);
System.out.println(driver.getPageSource());
In the above code I am getting content after clicking on first category(Office Suppliers) of homepage.But,in general we won't be knowing where we need to mouse hover or click on a page.So,I am looking for a general solution.