I'm trying to create a login test for Microsoft Dynamic 365.

I am able to fill in the login form fields, but the Sign in button is disabled until the user moves the mouse cursor


Debugging shows that this button should be enabled: enter image description here

The button has following attributes

<button id="cred_sign_in_button" class="button normaltext cred_sign_in_button refresh_domain_state control-button button-two button_primary" style="opacity: 1;">
        Sign in

I tried to set focus on it or move the mouse for some offset using a Selenium Action, but the browser doesn't consider this as the mouse moving. Only if I move the cursor by moving the mouse manually does it become active.

What causes this button to be disabled and how can I change its state?

Here is my code:

driver.Url = "https://identifying365.crm4.dynamics.com";

var Textbox_UserName = driver.FindElement(By.Id("cred_userid_inputtext"));
var Textbox_Password = driver.FindElement(By.Id("cred_password_inputtext"));
var Button_SignIn = driver.FindElement(By.Id("cred_sign_in_button"));

Textbox_UserName.SendKeys("[email protected]");
  • have you tried leveraging the "moveToElement" method in action?
    – DEnumber50
    Commented May 25, 2017 at 16:49
  • @DEnumber50 Yes, I tried moveToElement and moveByOffset but this button is still disabled
    – algot
    Commented May 25, 2017 at 20:16
  • You may have to trigger the onBlur or onFocus JavaScript event using the JavaScriptExecutor. And/Or, try putting a Sleep between putting in the username and password.
    – kirbycope
    Commented May 25, 2017 at 20:52
  • @kirbycope Yes, it works if I put Sleep before click. But I'd like to add smart wait to click it, not just wait for definite amount of time.
    – algot
    Commented May 26, 2017 at 7:49
  • @kirbycope OnBlur event also doest't work LoginPage.Button_SignIn.SendKeys(""); js.ExecuteScript("!!document.activeElement ? document.activeElement.blur() : 0"); LoginPage.Button_SignIn.Click();
    – algot
    Commented May 26, 2017 at 8:57

3 Answers 3


Finally I've found the cause of the disabling the button.

After user finishes typing the username system check if such user exists. At that time progress bar is displayed. After checking user is able to click Sign In.

So after filling username field I need to wait until progress bar is visible. Then I need to wait until progress bar is invisible and then fill password and press Sign In

var wait = new WebDriverWait(WebDriverManager.Driver, TimeSpan.FromSeconds(30));
var locator = By.Id("redirect_dots_animation");

Here is a link to Dave Haeffner's solution to using mouse hovers and the ActionBuilder: https://github.com/tourdedave/elemental-selenium-tips/tree/master/50-hovers/csharp

Its not a direct solution to your problem but it is a step in the right direction.

  • As I answered above I tried MoveToElement and MoveByOffset actions but it doesn't help
    – algot
    Commented May 25, 2017 at 20:17

In our Selenium test for Office365 we do not click the button we just send an ENTER-keypress. Just like most users will they will fill in the form and press ENTER to submit.

Now Office365 might have a slightly different login screen then MS Dynamics 365. Alternatively I would try to use TABS to move to the button and wait until it becomes active.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.