Hi I am a facebook Webdriver newbie. I need help on getting HTML source of an AJAX page.
Here is my expected results:
$first == HTML source of the 1st page.
$second == HTML source of the 2nd page.
But my Output:
$first == HTML source of the 1st page.
$second == $first
However, I could get the HTML source of the 2nd page when I landed on the 3rd page. I don't know why I can not get the current HTML on Current page.
Please Help!
Here is my code (using selenium-server-standalone-2.44.0.jar):
$host = 'http://localhost:4444/wd/hub';
$capabilities = DesiredCapabilities::firefox();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
// Openning page
$driver->get('http://ift.tt/1wtsW1j');
// Click 'Search'
$driver->findElement(WebDriverBy::className('yellow-submit'))->click();
// Wait until Ajax part loaded
$driver->wait(40)->until(
WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(
WebDriverBy::className('actions-container')
));
// Print HTML of the 1st page
$first = $driver->getPageSource();
print_r($first);
// go to 2nd page
$driver->findElement(WebDriverBy::id('next'))->click();
// Wait until the 2nd page is loaded
$driver->wait(40)->until(
WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(
WebDriverBy::className('actions-container')
));
// Print HTML of the 2nd page
$second = $driver->getPageSource();
print_r($second);
$driver->quit();
Aucun commentaire:
Enregistrer un commentaire