Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions FluentAutomation.SeleniumWebDriver/CommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ public void DoubleClick(ElementProxy element)
});
}

public void ExecuteJavaScript(string script)
{
this.Act(CommandType.Action, false, () =>
{
var jsExec = this.webDriver as IJavaScriptExecutor;
jsExec.ExecuteScript(script);
});
}

public void RightClick(int x, int y)
{
this.Act(CommandType.Action, () =>
Expand Down
5 changes: 5 additions & 0 deletions FluentAutomation.SeleniumWebDriver/MultiCommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public void DoubleClick(ElementProxy element, int x, int y)
public void DoubleClick(ElementProxy element)
{
this.RepackExceptions(() => Parallel.ForEach(element.Elements, e => e.Item1.DoubleClick(new ElementProxy(e.Item1, e.Item2))));
}

public void ExecuteJavaScript(string script)
{
this.RepackExceptions(() => Parallel.ForEach(this.commandProviders, xx => xx.ExecuteJavaScript(script)));
}

public void RightClick(int x, int y)
Expand Down
8 changes: 8 additions & 0 deletions FluentAutomation.WatiN/CommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ public void DoubleClick(ElementProxy element)
this.ActiveDomContainer.Eval(string.Format("if (typeof jQuery != 'undefined') {{ jQuery({0}).dblclick(); }}", el.AutomationElement.GetJavascriptElementReference()));
});
}

public void ExecuteJavaScript(string script)
{
this.Act(CommandType.Action, false, () =>
{
this.browser.Eval(script);
});
}

public void RightClick(int x, int y)
{
Expand Down
6 changes: 6 additions & 0 deletions FluentAutomation/ActionSyntaxProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public IActionSyntaxProvider Click(Alert alertAccessor)
return this;
}

public IActionSyntaxProvider ExecuteJavaScript(string script)
{
this.commandProvider.ExecuteJavaScript(script);
return this;
}

public IActionSyntaxProvider Scroll(int x, int y)
{
this.commandProvider.Hover(x, y);
Expand Down
7 changes: 6 additions & 1 deletion FluentAutomation/BaseCommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ private void FireExpectFailed()
}

public void Act(CommandType commandType, Action action)
{
this.Act(commandType, this.WaitOnAction(commandType), action);
}

protected void Act(CommandType commandType, bool waitOnAction, Action action)
{
bool originalWaitOnActions = this.Settings.WaitOnAllActions;
try
{
if (this.WaitOnAction(commandType))
if (waitOnAction)
{
this.WaitUntil(() => action(), this.Settings.WaitUntilTimeout);
}
Expand Down
7 changes: 7 additions & 0 deletions FluentAutomation/Interfaces/IActionSyntaxProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ public interface IActionSyntaxProvider : ISyntaxProvider
/// <param name="y">Y-coordinate offset.</param>
IActionSyntaxProvider DoubleClick(string selector, int x, int y);

/// <summary>
/// Executes a script.
/// </summary>
/// <param name="script">The script.</param>
/// <returns></returns>
IActionSyntaxProvider ExecuteJavaScript(string script);

/// <summary>
/// RightClick at the specified coordinates.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions FluentAutomation/Interfaces/ICommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public interface ICommandProvider : IDisposable
void AlertClick(Alert accessor);
void AlertText(Action<string> matchFunc);
void AlertEnterText(string text);
void Visible(ElementProxy element, Action<bool> action);

void Visible(ElementProxy element, Action<bool> action);
void ExecuteJavaScript(string script);
void CssPropertyValue(ElementProxy element, string propertyName, Action<bool, string> action);

void Act(CommandType commandType, Action action);
Expand Down
2 changes: 1 addition & 1 deletion FluentAutomation/Properties/AssemblyGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyVersion("3.0.2.0")]