2

I am using Fluent Automation in my project to create more human-readable tests. Info available here http://fluent.stirno.com/ and on GitHub: https://github.com/stirno/FluentAutomation

I need to be able to perform some things that are not implemented with fluent automation and would like to be able to get a hold of the browser or WatiN element. I am actually trying to run a LINQ query such as this:

var indicators = from i in this.CurrentBrowser.Links
where i.Url.Contains("LeadsMine.aspx?flag")
select i;

Any ideas?

Thank you in advance!

Nick Jones
  • 4,395
  • 6
  • 33
  • 44
lstanczyk
  • 1,313
  • 13
  • 20

1 Answers1

2

Just a reference for anyone that may find this later. We had a discussion about how to deal with this as part of a Fluent Automation GitHub Issue, with a couple different solutions.

Ideally any user interaction would be dealt with using the actual I.Click("#button") type actions, but in a fringe case like this where you have something like plugin/flash/java/you-name-it based UI elements, you either need to:

  1. Add an extension method to support this, as lstanczyk did, or
  2. Do something like a click event on an invisible or off-screen element, with an onclick that fires a JavaScript API to work with the plugin.

lstanczyk's own solution was adding an extension method:

public static void RunScript(this FluentAutomation.Interfaces.INativeActionSyntaxProvider I, string scriptCode)
{
    FluentAutomation.Element bodyTag = I.Find("body").Invoke() as FluentAutomation.Element;
    bodyTag.AutomationElement.DomContainer.RunScript(scriptCode);
}

And then invoking it with I.RunScript(script); where script is JavaScript in a string.

pauljz
  • 10,803
  • 4
  • 28
  • 33