0

I'm trying to automate a site but stuck at the point where I need to complete the onboarding process of the user account.

So the problem is I have to add a user and to add the user I have to go through few steps, I have successfully added the user details but when I click on continue button it does not navigates me to the next on same page.

I want to know that how can I navigate to the next step on the same page button by clicking the continue button

Here is my code

public void enter_advisor_details() {
    driver.findElement(user_mgmt_opt).click();
    driver.findElement(advisor_tab).click();
    driver.findElement(add_advisor_btn).click();
    driver.findElement(first_name).sendKeys("Test");
    driver.findElement(last_name).sendKeys("Automation");
    driver.findElement(email).sendKeys("TestAuto@gmail.com");

    WebElement element = driver.findElement(By.xpath("//div[@class='mt-8']//button"));
    

    element.click();
}

Note: I have tried Actions class, WebDriverWait and JavaScript executor but nothing works for me

As you can see in the below image the test is getting passed and the button is clicked and the next step does not show up

enter image description here

1 Answers1

2

You are probably missing a delay. Wait for element to become clickable before clicking it, as following:

WebDriverWait wait = new WebDriverWait(driver, 20); 
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='mt-8']//button"))).click();
Prophet
  • 32,350
  • 22
  • 54
  • 79
  • No, i have tried to add waits before clicking the button but it does not work, Actually the button is getting clicked but it does not navigates me to the next step, When I click manually it works but in automation it does not – Muhammad Danish Mustafa Nov 24 '22 at 13:14
  • Can you share a link to that page so we can debug it? – Prophet Nov 24 '22 at 13:15