Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding PCF Controls HTML (UCIBrowser iFrames) #146

Open
s1m0nj opened this issue Nov 18, 2022 · 2 comments
Open

Finding PCF Controls HTML (UCIBrowser iFrames) #146

s1m0nj opened this issue Nov 18, 2022 · 2 comments

Comments

@s1m0nj
Copy link

s1m0nj commented Nov 18, 2022

Hi,

I'm trying to write a step to test a PCF Control but I cant find the HTML elements using a Selimumn driver.FindElements(By.ClassName("btn-cta")) in my command.

Looking at the HTML There is an iFrame, so assume using UCIBrowser I should switch iFrames.

Selenium has the SwitchTo method
https://www.guru99.com/handling-iframes-selenium.html

Whats the recommended approach for getting to WebElements in a PCF controls please?

@s1m0nj
Copy link
Author

s1m0nj commented Nov 21, 2022

OK, it was a web resource hence the need for an iFrame. I've written something to change context and then look for child elements.

I'm happy to contribute with pull requests or create our own dll to help others.
Cheers
Si www.xrm.je

When the Case has a Quick Actions feature
And a button called Resolve is visible 
And a button called Resolve is clicked
        [When(@"the (.*) web resource (.*) ")]
        [Then(@"the (.*) web resource (.*) ")]
        [When(@"the (.*) has a (.*) feature")]
        [Then(@"the (.*) has a (.*) feature")]
        [When(@"the (.*) has the (.*) feature")]
        [Then(@"the (.*) has the (.*) feature")]
        public void WhenTheAliasWebResource(string alias, string webResoruce)
        {
            _crmContext.CommandProcessor.Execute(new SwitchToWebResoruce(_crmContext, _seleniumContext, alias, webResoruce));
        }

        [When(@"a (.*) called (.*) is visible")]
        [Then(@"a (.*) called (.*) is visible")]
        public void WhenATagWithTextIsVisible(string tag, string containsText)
        {
            _crmContext.CommandProcessor.Execute(new AssertElementContainsTextIsVisibleCommand(_crmContext, _seleniumContext, tag, containsText));
        }

        [When(@"a (.*) called (.*) is clicked")]
        [Then(@"a (.*) called (.*) is clicked")]
        public void WhenATagWithTextIsClicked(string tag, string containsText)
        {
            _crmContext.CommandProcessor.Execute(new ElementContainsTextIsClickedCommand(_crmContext, _seleniumContext, tag, containsText));
        }

@mVermaat
Copy link
Owner

So basically it isn't a PCF control but a HTML web resource? Also can you give some details of what is behind the commands?

I think being able to work with a HTML resource makes sense and would be a good addition. The thing is that all steps should be about behavior and not actions like this. Changing it to behavior will be quite difficult, as the content of the HTML resource will be different per implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants