From 77e0062fc355c45700b29aa314c852c44acbb843 Mon Sep 17 00:00:00 2001 From: Jake Rote Date: Mon, 10 Apr 2017 13:30:13 +0100 Subject: [PATCH] Added XPath for right click (#59) --- Xenon.nuspec | 4 ++-- Xenon/BaseXenonTest.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Xenon.nuspec b/Xenon.nuspec index 8381b36..9bd7c30 100644 --- a/Xenon.nuspec +++ b/Xenon.nuspec @@ -3,7 +3,7 @@ Xenon - 0.1.23 + 0.1.25 Xenon Liquid Thinking https://github.com/LiquidThinking/Xenon @@ -14,7 +14,7 @@ There are the following pre-built browser automation wrappers: http://www.nuget.org/packages/Xenon.Selenium/ - Added ContainsText in XenonElementsFinder + Added RightClick support diff --git a/Xenon/BaseXenonTest.cs b/Xenon/BaseXenonTest.cs index 2706a4f..fc545be 100644 --- a/Xenon/BaseXenonTest.cs +++ b/Xenon/BaseXenonTest.cs @@ -112,6 +112,20 @@ public T Click( Func where, AssertionF customPostWait ); } + /// + /// Right clicks the element specified + /// By default waits for the element to exist before clicking + /// + /// The css selector of the element + /// Custom action wait upon before clicking to the element + /// Custom action wait upon after clicking to the element + public T RightClick( Func where, AssertionFunc customPreWait = null, AssertionFunc customPostWait = null ) + { + return RunTask( browser => where( new XenonElementsFinder( browser ) ).FindElements().LocateSingleVisibleElement().RightClick(), + customPreWait ?? ( a => a.CustomAssertion( b => where( new XenonElementsFinder( b ) ).FindElements().LocateSingleVisibleElement().IsVisible ) ), + customPostWait ); + } + /// /// Enters the text into the element specified. /// By default waits for the element to exist before entering the text