Giter Club home page Giter Club logo

Comments (6)

dtu11 avatar dtu11 commented on July 20, 2024

You would have to handle the login for the application. If you're using integrated authentication then you would just need to build in a wait time. It would look something like this.

            xrmBrowser.Driver.WaitUntilVisible(By.XPath("id(\"crmTopBar\"")
                    , new TimeSpan(0, 0, 60),
                    e => { xrmBrowser.Driver.WaitForPageToLoad(); },
                    f => { throw new Exception("Login failed."); });

If you're using IFD then look at the ADFSLogin.cs sample test. After that then all of the API's should work.

If you're getting the windows login prompt then the API's will not handle that.

from easyrepro.

gohiljayraj avatar gohiljayraj commented on July 20, 2024

Thanks Daren for your reply. I am able to login in CRM for IFD, but ADFSLogin sample does't seems to be working. This is what I have done:

public static void Login()
{
SecureString userName = ConfigurationManager.AppSettings["Uname"].ToSecureString();
SecureString password = ConfigurationManager.AppSettings["Pwd"].ToSecureString();
Uri xrmUri = new Uri(ConfigurationManager.AppSettings["CrmUrl"].ToString());
xrmBrowser.GoToXrmUri(xrmUri);

        xrmBrowser.LoginPage.Login(xrmUri, userName, password, ADFSLoginAction);

}
public static void ADFSLoginAction(LoginRedirectEventArgs args)
{

        args.Driver.FindElement(By.CssSelector("#UsernameTextBox")).SendKeys(args.Username.ToUnsecureString());
        args.Driver.FindElement(By.CssSelector("#PasswordTextBox")).SendKeys(args.Password.ToUnsecureString());
        
        args.Driver.FindElement(By.CssSelector("#SubmitButton")).Submit();
        //args.Driver.FindElement(By.Id("idSIButton9")).Submit();
        xrmBrowser.Driver.WaitUntilVisible(By.XPath("id(\"crmTopBar\"")
                , new TimeSpan(0, 0, 60),
                e => { xrmBrowser.Driver.WaitForPageToLoad(); },
                f => { throw new Exception("Login failed."); });

        try
        { //Workaround for the email not sent warning dialog in the QA environement.
            var iframeElement = args.Driver.FindElement(By.Id("InlineDialog_Iframe"));
            args.Driver.SwitchTo().Frame(iframeElement);
        }//close try
        catch (NoSuchElementException) { return; } //If there is no warning dialog we are done
                                                   //TODO: Log presence of warning dialog 
                                                   //Since we have an Iframe switch to it
        
        args.Driver.FindElement(By.Id("crmDialogFooter"));
        args.Driver.FindElement(By.XPath("//*[@id=\"crmDialogFooter\"]/div[2]"));
        //Due to issues with the framework click is not handled correctly and throws a no such element error
        // Thus the try catch wrapper.
        try { args.Driver.FindElement(By.XPath("//*[@id=\"butBegin\"]")).Click(); }
        catch (NoSuchElementException)
        { //Log that we closed a dialog window.
        }//close catch for Click action
    }

from easyrepro.

Kraviecc avatar Kraviecc commented on July 20, 2024

Hi,

@gohiljayraj - I've created pull request with my changes to make it work with onprem versions, check this out :) If you'll have any sugestions, let me know.

from easyrepro.

th0car avatar th0car commented on July 20, 2024

Thank you for this @Kraviecc ! I have started testing your sample solution and it seems to be working just fine this far. Does the fact that the CLA requirements were met mean that your branch will actually be merged into the official master?
I work with products that needs to be continously tested for both On Prem and Online deployment so for me it would really be a great addition to Easyrepro if it officially started supporting also the latest On Prem CRM versions. Let me know if I can help out in any way!

from easyrepro.

Kraviecc avatar Kraviecc commented on July 20, 2024

Thanks, @th0car !

Unfortunately, the CLA requirements are just one thing before real Microsoft's analyze takes place and before their decision whether it should be merged or not. I've done the really huge changes in the whole solution so I'm afraid it's too much, but who knows?

Regardless of whether it'll be merged or not, I plan to maintain and develop new features/functionalities inside my fork. I'll be glad if you want to help me out or give some advice or point some stuff which should be implemented (or bugs if any) - feel free to commit updates. To be honest, I don't have much time at this moment, so I'm afraid that in the near future there will be no updates.

Keep in touch!

from easyrepro.

TYLEROL avatar TYLEROL commented on July 20, 2024

To close the loop on this thread. A new OnPremises release branch was created to track OnPremises specific scenarios. The branch should work as-is for now. If issues are identified we encourage to either raise new issues and we'll attempt to tackle them as time allows, or for the community to check in fixes for review.

from easyrepro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.