Put sleep. It will work.
time.sleep(“Seconds_as_per_your_wish”);
I think this is the single reason that the page wasn't getting loaded.
I am assuming that you may need some reference for “Wait for page load in Selenium”, you can check the below code to know how to wait for the load.
In my case, I used the following to know the page load status. In our application loading gif(s) are present and, I listen to them as follows to eliminate unwanted wait time in the script.
public static void processing(){
WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='Msgpanel']/div/div/img")));
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[@id='Msgpanel']/div/div/img"))); }
Where the xpath locates the gif in the HTML DOM. After this, You may also implement your action methods Click.
public static void click(WebElement elementToBeClicked){
WebDriverWait wait = new WebDriverWait(driver, 45); wait.until(ExpectedConditions.visibilityOf(element)); wait.until(ExpectedConditions.elementToBeClickable(element)); wait.ignoring(NoSuchElementException.class).ignoring(StaleElementReferenceException.class); elementToBeClicked.click();
}
If you want to Learn What is Selenium visit this Selenium Tutorial by Intellipaat.
If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, you should enroll yourself in industry-based Selenium online courses!