Open s1m0nj opened 1 year ago
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));
}
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.
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?