Теперь, поскольку ваш usecase относится к полной загрузке страницы, вы можете использовать pageLoadStrategy(), для которогоnormal установлено значение [ поддерживаемые значения - none, eagleed или normal ], используя либо через экземпляр класса DesiredCapabilities, либо через класс ChromeOptions, как указано ниже :
Теперь, установив для pageLoadStrategy значение NORMAL, и ваша пробная версия кода гарантируют, что браузерный клиент (т. Е. веб-браузер) достиг 'document.readyState' значения"complete". Как только это условие выполнено, Selenium выполняет следующую строку кода.
Now, the above two approaches through PageLoadStrategy and "return jQuery.active == 0" looks to be waiting for indefinite events. So for a definite wait you can induce WebDriverWait inconjunction with ExpectedConditions set to titleContains() method which will ensure that the Page Title (i.e. the Web Page) is visible and assume the all the elements are also visible as follows :
Now, at times it is possible though the Page Title will match your Application Title still the desired element you want to interact haven't completed loading. So a more granular approach would be to induce WebDriverWait inconjunction with ExpectedConditions set to visibilityOfElementLocated() method which will make your program wait for the desired element to be visible as follows :