There is a goal using the Powershell script to parse a page that does not load immediately. How can you understand using Powershell when the page is fully loaded? I googled and found 2 options :

  1. Find an element that is already present on the final page, and use the start-sleep to parse the page until the element appears on the page;
    • It does not fit, because when the service conducts those works, the element that is displayed after the full rendering of the page may never appear.
  2. Use the InternetExplorer Com object and use the while($IE.busy) {Start-Sleep 1} wait again until the page is fully loaded.
    • I don’t really want to use it as now I’ll test the script on windows, but in the future I’m planning to transfer it to Linux. And though Powershell and .NET have been ported to Linux, I do not know how the InternetExplorer COM object will work there.
  • "How to get the code of the page in Powershell after it is fully loaded" - so it will probably be a more correct wording. - Artem Sabanov
  • meaning? Some parts of the site may be loaded in response to user actions. what will you do with it? - teran
  • @teran, there will be no such thing. This is a statistics page. It is necessary to parse it for further analysis. - Artem Sabanov

1 answer 1

then why do you implement on Powershell? With whom objects most likely nothing ..
Write directly to Python.

 if __name__ == "__main__": import requests import time while True: r = requests.get('http://google.com/') # для теста строку поиск поменять на Поиск1 if r.text.find("Поиск")>0: break time.sleep(5) print('пробую еще раз') print('нашёл')