Answer the question
In order to leave comments, you need to log in
How to implement infinite webdriver loop in php?
I need to parse a div from the site, in view of certain obstacles, I had to implement it using WebDriver , this is the first time I'm dealing with it ...
In general, everything works, I receive data, but I ran into a difficulty!
The div is updated on the page without reloading the page, once at a certain time.
It seems to me not quite right to close and restart emulation and parsing every time...
How to correctly implement getting an element from the request page without having to close the current process window!? Maybe something related to the infinite loop and sleep? Tell me how to implement it correctly!?
Thank you!
Answer the question
In order to leave comments, you need to log in
Implemented like this, I'm not sure if this is the right solution, but it works!
ini_set('max_execution_time', 60 * 60 * 24);
while(true):
...
$parsing = $driver->findElement(
WebDriverBy::className('class_name')
)->getAttribute('innerHTML');
...
sleep(15);
endwhile;
The div is updated on the page without reloading the page, once at a certain time.Most likely it is dragged by Ajax from the server, just look where the data comes from, drag it directly from there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question