D365 CRM: Use Selenium IDE to select controls in the Entity Form for Test Automation



  • By default, when you are building an automated test process using the Selenium IDE, this program will select the controls by ID or CSS Class by default. But some pages have the little problem that the ID or the Class value change in every refresh/session so this will throw an exception in the test process. An example of this is the Model Driven form of D365 CRM. Let’s take the example to select the Save button of the ribbon:

     

    In the next refresh/session the Id will change like this:

     

    Notice how the Id of the button change from contact|NoRelationship|Form|Mscrm.SavePrimary01-button to contact|NoRelationship|Form|Mscrm.SavePrimary00-button. How to avoid it? Using the “xpath contains” selector instead of the id like this:

    xpath=//button[contains(@id, contact|NoRelationship|Form|Mscrm.SavePrimary')]

    The xpath will look for a button where the attribute id contains “contact|NoRelationship|Form|Mscrm.SavePrimary”. You can use other attributes instead of “id” like “class”, “title”, etc.

    Source:
    https://ui.vision/rpa/docs/selenium-ide/locators 

    Enjoy it!
     


  • Comments



Add a Comment