How to get pagecontent of all ajax events in a website using Phantomjs using java

11 views
Skip to first unread message

Santosh Gdr

unread,
Jul 3, 2015, 1:08:42 AM7/3/15
to phan...@googlegroups.com
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.
Reply all
Reply to author
Forward
0 new messages