Answer the question
In order to leave comments, you need to log in
Why in Selenium facebook webDriver does not want to work wait?
Hello.
I want to parse a site on which, immediately after loading, there is an ajax request to add the main content.
Actually, I want to get it, but what I don’t try constantly gives an error: "Unable to find element".
Tried like this:
$host = 'http://127.0.0.1:4444/wd/hub';
$capabilities = DesiredCapabilities::firefox();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
$url = "https://www.myscore.ru";
$driver->get($url);
$driver->manage()->timeouts()->implicitlyWait(30);
$driver->wait(30, 1000)->until(
WebDriverExpectedCondition::elementToBeClickable( WebDriverBy::xpath('//*[@id="ifmenu-calendar"]/*[contains(@class,"tomorrow")]'))
);
// По другому:
$driver->wait()->until(
function () use ($driver) {
$e = $driver->findElements(WebDriverBy::cssSelector('#ifmenu-calendar .tomorrow'));
return count($e) == 1;
},
'Error'
);
$driver->wait(30, 2000)->until(function ($driver) {
return !$driver->executeScript('return jQuery.active');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question