2

Hi I am trying to write test script using selenium webdriver to log in to ms dynamics free trial registration @ https://www.microsoft.com/en-us/dynamics/free-crm-trial.aspx I am stuck at one of pages in registration I am unable to move to button Create my account in attached screenshot

    //set driver settings
    driver.get("https://www.microsoft.com/en-us/dynamics/free-crm-trial.aspx");
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);

    //click on get started and switch to tab 2 
    WebElement startButtton = driver.findElement(By.id("Lead:Crm:Trial"));
    startButtton.click();
    ArrayList<String> tabs2 = new ArrayList<String> (driver.getWindowHandles());
    driver.switchTo().window(tabs2.get(1));

    //fill form data and click on next button
    Select droplist = new Select(driver.findElement(By.id("StepsData_SelectedRegion")));   
    droplist.selectByVisibleText("India");

    driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);

    WebElement FirstName = driver.findElement(By.name("StepsData.FirstName"));
    WebDriverWait wait1 = new WebDriverWait(driver, 60);
            wait1.until(ExpectedConditions.stalenessOf(FirstName));
    WebElement FirstName1 = driver.findElement(By.name("StepsData.FirstName"));
    FirstName1.sendKeys("gayatri");

    WebElement LastName = driver.findElement(By.name("StepsData.LastName"));
    //WebDriverWait wait = new WebDriverWait(driver, 60);
    //wait.until(ExpectedConditions.stalenessOf(LastName));
    WebElement LastName2 = driver.findElement(By.name("StepsData.LastName"));
    LastName2.sendKeys("kulkarni");

    WebElement EmailAddress = driver.findElement(By.id("StepsData_EmailAddress"));
    EmailAddress.sendKeys("[email protected]");

    WebElement PhoneNumber = driver.findElement(By.id("PhoneNumber"));
    PhoneNumber.sendKeys("8888888888");

    WebElement OrganizationName = driver.findElement(By.id("StepsData_OrganizationName"));
    OrganizationName.sendKeys("company");

    Select language = new Select(driver.findElement(By.id("StepsData_OrganizationLanguage")));   
    language.selectByVisibleText("English");

    Select OrgSize = new Select(driver.findElement(By.id("StepsData_OrgSize")));   
    OrgSize.selectByValue("50-249");

    WebElement NextButton = driver.findElement(By.id("MultiPageLayout_Next"));
    NextButton.click();

    //fill form data and click on create my account button
    WebElement UserId = driver.findElement(By.id("StepsData_UserId"));
    UserId.sendKeys("gayatrik2512");
    WebElement DomainName = driver.findElement(By.id("StepsData_DomainName"));
    DomainName.sendKeys("meetQA");

    WebElement Password = driver.findElement(By.id("Password"));
    Password.sendKeys("xxxxx@123");
    WebElement Repassword = driver.findElement(By.id("RePassword"));
    Repassword.sendKeys("xxxxx@123");

    WebElement EmailCheck = driver.findElement(By.id("StepsData_EmailCheckboxChecked"));
    if(!(EmailCheck.isSelected()))          
    EmailCheck.click();

    WebElement PhoneCheck = driver.findElement(By.id("StepsData_PhoneAgreementCheckboxChecked"));
    if(!(PhoneCheck.isSelected()))          
        EmailCheck.click();

    WebElement PartCheck = driver.findElement(By.id("StepsData_PartnerAgreementCheckboxChecked"));
    if(!(PartCheck.isSelected()))           
        PartCheck.click();

    **Actions act = new Actions(driver);
    act.moveToElement(driver.findElement(By.id("MultiPageLayout_Next"))).click().build().perform();**

    PFA screenshot

enter image description here

5
  • where exactly you got stuck?
    – Yu Zhang
    Commented Mar 7, 2017 at 9:32
  • unable to click last button >> act.moveToElement(driver.findElement(By.id("MultiPageLayout_Next"))).click().build().perform();
    – gayatri
    Commented Mar 7, 2017 at 9:47
  • What happens when you try to click? Is an exception thrown? Does the click just not fire? Also, any chance you can include html for the button in the question?
    – mrfreester
    Commented Mar 7, 2017 at 17:42
  • Please put the html part you are trying to interact with as we can't see the html from a screenshot. Based on what I'm seeing you shouldn't need the moveToElement but just the click as mentioned by mrfreester. However, in the post below it looks like you are struggling with getting the focus to change...which would indicate you are not finding the element correctly and it's just firing the click at the present location instead of on the element. We need the HTML...
    – mutt
    Commented Mar 7, 2017 at 22:44
  • I have mentioned url Its one of the pages @ microsoft.com/en-us/dynamics/free-crm-trial.aspx
    – gayatri
    Commented Mar 13, 2017 at 4:23

1 Answer 1

-1

Sorry, I cannot comment as I do not have the required reputation, but why are you using moveToElement? If you want to click, try this:

findElement(By.id("MultiPageLayout_Next")).click()

5
  • Its not working for me When I run the script, user id input box remains focused
    – gayatri
    Commented Mar 7, 2017 at 12:05
  • getting exception as when executed for classname selector org.openqa.selenium.InvalidSelectorException: invalid selector: Compound class names not permitted
    – gayatri
    Commented Mar 7, 2017 at 12:27
  • try this, as the previous one I tested on Selenium IDE on Firefox, for this one I used your code to run and It was able to click on the button on Chrome findElement(By.id("MultiPageLayout_Next")).click()
    – theabrar
    Commented Mar 8, 2017 at 17:40
  • @gayatri could you please try that, let me edit my answer as well.
    – theabrar
    Commented Mar 10, 2017 at 10:32
  • I tried driver.findElement(By.id("MultiPageLayout_Next")).click(); But still getting same problem Script haults at screen attached
    – gayatri
    Commented Mar 13, 2017 at 6:14

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.