Wait for page load in Selenium

In Selenium, you can use the WebDriverWait class to wait for a page to load.

Here is an example of how to do this in Java:

WebDriver driver = new ChromeDriver();
driver.get("http://www.example.com");

// Wait for the page to load, timeout after 10 seconds
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("some-element-id")));

// Page is loaded, do something here

This will wait up to 10 seconds for the element with ID "some-element-id" to be visible. If the element becomes visible before the timeout, the script will continue execution. If the timeout is reached and the element is still not visible, a TimeoutException will be thrown.

You can also use other ExpectedConditions to wait for different page events, such as the presence of an element, the absence of an element, or the text of an element to match a certain value.

I hope this helps! Let me know if you have any questions.