diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Elements/Telemetry.cs b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Elements/Telemetry.cs index be2609be..f91de07b 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Elements/Telemetry.cs +++ b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Elements/Telemetry.cs @@ -7,7 +7,11 @@ using System.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; +#if !NET462 +using Nancy.Json; +#else using System.Web.Script.Serialization; +#endif using Newtonsoft.Json; using Microsoft.ApplicationInsights.DataContracts; diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj index 89c15206..449d5b61 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj @@ -1,135 +1,40 @@ - - - + - Debug - AnyCPU - {AFCB5BB5-4512-4019-A911-5D56CFF4F3D0} Library - Properties - Microsoft.Dynamics365.UIAutomation.Api.UCI - Microsoft.Dynamics365.UIAutomation.Api.UCI - v4.6 - 512 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 7.2 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + net6.0;net462;netcoreapp3.1 + false 7.2 - - ..\packages\Microsoft.ApplicationInsights.2.11.0\lib\net46\Microsoft.ApplicationInsights.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\Otp.NET.1.2.1\lib\net45\Otp.NET.dll - - - - ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll - - - - ..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll - - - - ..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - - - - ..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll - - - ..\packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + none + + + none + + + + + + - - {dfe2c141-f1aa-4d4b-8df8-0fb93023cf45} - Microsoft.Dynamics365.UIAutomation.Api - - - {c9748803-f3cb-4531-b313-bc24d4d0bf0c} - Microsoft.Dynamics365.UIAutomation.Browser - + - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/packages.config b/Microsoft.Dynamics365.UIAutomation.Api.UCI/packages.config deleted file mode 100644 index 10664e4d..00000000 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/packages.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj b/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj index 1a440f8a..8751200f 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj @@ -1,136 +1,32 @@ - - - + - Debug - AnyCPU - {DFE2C141-F1AA-4D4B-8DF8-0FB93023CF45} - Library - Properties - Microsoft.Dynamics365.UIAutomation.Api - Microsoft.Dynamics365.UIAutomation.Api - v4.6 - 512 - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 7.2 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + net6.0;net462;netcoreapp3.1 + false 7.2 - - false - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - - ..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll - - - ..\packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - Designer - + + + + + + + + + - - {c9748803-f3cb-4531-b313-bc24d4d0bf0c} - Microsoft.Dynamics365.UIAutomation.Browser - + - - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Api/Pages/PerformanceCenter.cs b/Microsoft.Dynamics365.UIAutomation.Api/Pages/PerformanceCenter.cs index e4b411d9..6850c2c3 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api/Pages/PerformanceCenter.cs +++ b/Microsoft.Dynamics365.UIAutomation.Api/Pages/PerformanceCenter.cs @@ -1,6 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +#if !NET462 +using Nancy.Json; +#else +using System.Web.Script.Serialization; +#endif using Microsoft.Dynamics365.UIAutomation.Browser; using Newtonsoft.Json.Linq; using OpenQA.Selenium; @@ -8,7 +13,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Web.Script.Serialization; namespace Microsoft.Dynamics365.UIAutomation.Api { @@ -110,7 +114,7 @@ public BrowserCommandResult> GetMarkersRaw() jsSerializer.RegisterConverters(new[] { new DynamicJsonConverter() }); - var jsonObj = (Dictionary)jsSerializer.Deserialize(jsonResults, typeof(Dictionary)); + var jsonObj = (Dictionary)jsSerializer.Deserialize>(jsonResults); return jsonObj; }); diff --git a/Microsoft.Dynamics365.UIAutomation.Api/packages.config b/Microsoft.Dynamics365.UIAutomation.Api/packages.config deleted file mode 100644 index 2c229364..00000000 --- a/Microsoft.Dynamics365.UIAutomation.Api/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs b/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs index cda6874f..76f077f4 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs +++ b/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs @@ -252,10 +252,7 @@ public virtual InternetExplorerOptions ToInternetExplorer() public virtual FirefoxOptions ToFireFox() { - var options = new FirefoxOptions() - { - UseLegacyImplementation = false - }; + var options = new FirefoxOptions(); if (!string.IsNullOrEmpty(DownloadsPath)) { @@ -273,8 +270,8 @@ public virtual EdgeOptions ToEdge() var options = new EdgeOptions() { PageLoadStrategy = PageLoadStrategy.Normal, - UseInPrivateBrowsing = PrivateMode }; + options.AddArgument("inprivate"); return options; } diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/DynamicJsonConverter.cs b/Microsoft.Dynamics365.UIAutomation.Browser/DynamicJsonConverter.cs index 2a6f8e75..a779a776 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/DynamicJsonConverter.cs +++ b/Microsoft.Dynamics365.UIAutomation.Browser/DynamicJsonConverter.cs @@ -8,7 +8,11 @@ using System.Dynamic; using System.Linq; using System.Text; +#if !NET462 +using Nancy.Json; +#else using System.Web.Script.Serialization; +#endif namespace Microsoft.Dynamics365.UIAutomation.Browser { diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/Extensions/SeleniumExtensions.cs b/Microsoft.Dynamics365.UIAutomation.Browser/Extensions/SeleniumExtensions.cs index 89aeae84..d9c422de 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/Extensions/SeleniumExtensions.cs +++ b/Microsoft.Dynamics365.UIAutomation.Browser/Extensions/SeleniumExtensions.cs @@ -6,6 +6,12 @@ using OpenQA.Selenium.Interactions; using OpenQA.Selenium.Support.Events; using OpenQA.Selenium.Support.UI; +using SeleniumExtras.WaitHelpers; +#if !NET462 +using Nancy.Json; +#else +using System.Web.Script.Serialization; +#endif using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -14,13 +20,12 @@ using System.Drawing; using System.IO; using System.Linq; -using System.Web.Script.Serialization; namespace Microsoft.Dynamics365.UIAutomation.Browser { public static class SeleniumExtensions { - #region Click +#region Click public static void Click(this IWebElement element, bool ignoreStaleElementException) { @@ -70,12 +75,12 @@ public static void Hover(this IWebElement element, IWebDriver driver, bool ignor } } - #endregion Click +#endregion Click public static void Click(this IWebDriver driver, IWebElement element, Func offsetFunc = null, bool ignoreStaleElementException = true) => driver.Perform(a => a.Click(), element, offsetFunc, ignoreStaleElementException); - #region Double Click +#region Double Click public static void DoubleClick(this IWebDriver driver, IWebElement element, Func offsetFunc = null, bool ignoreStaleElementException = true) => driver.Perform(a => a.DoubleClick(), element, offsetFunc, ignoreStaleElementException); @@ -102,9 +107,9 @@ public static void Perform(this IWebDriver driver, Func action } - #endregion +#endregion - #region Script Execution +#region Script Execution [DebuggerNonUserCode] public static object ExecuteScript(this IWebDriver driver, string script, params object[] args) @@ -168,9 +173,9 @@ private static string SanitizeReturnStatement(string script) return script; } - #endregion Script Execution +#endregion Script Execution - #region Browser Options +#region Browser Options [DebuggerNonUserCode] public static void ResetZoom(this IWebDriver driver) @@ -179,9 +184,9 @@ public static void ResetZoom(this IWebDriver driver) element.SendKeys(Keys.Control + "0"); } - #endregion Browser Options +#endregion Browser Options - #region Screenshot +#region Screenshot [DebuggerNonUserCode] public static Screenshot TakeScreenshot(this IWebDriver driver) @@ -195,22 +200,9 @@ public static Screenshot TakeScreenshot(this IWebDriver driver) return screenshotDriver.GetScreenshot(); } - [DebuggerNonUserCode] - public static Bitmap TakeScreenshot(this IWebDriver driver, By by) - { - var screenshot = TakeScreenshot(driver); - var bmpScreen = new Bitmap(new MemoryStream(screenshot.AsByteArray)); - - // Measure the location of a specific element - IWebElement element = driver.FindElement(by); - var crop = new Rectangle(element.Location, element.Size); - - return bmpScreen.Clone(crop, bmpScreen.PixelFormat); - } - - #endregion Screenshot +#endregion Screenshot - #region Elements +#region Elements public static bool HasAttribute(this IWebElement element, string attributeName) => element.GetAttribute(attributeName) != null; @@ -276,9 +268,9 @@ public static void ClearFocus(this IWebDriver driver) driver.FindElement(By.TagName("body")).Click(); } - #endregion Elements +#endregion Elements - #region Waits +#region Waits public static bool WaitForPageToLoad(this IWebDriver driver, TimeSpan? timeout = null) { @@ -634,9 +626,9 @@ public static bool RepeatUntil(this IWebDriver driver, Action action, Predicate< return success; } - #endregion Waits +#endregion Waits - #region Args / Tracing +#region Args / Tracing public static string ToTraceString(this FindElementEventArgs e) { @@ -657,6 +649,6 @@ public static string ToTraceString(this FindElementEventArgs e) return method; } - #endregion Args / Tracing +#endregion Args / Tracing } } \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj b/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj index 0808752a..0abcacc4 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj @@ -1,119 +1,47 @@ - - - + - Debug - AnyCPU - {C9748803-F3CB-4531-B313-BC24D4D0BF0C} - Library - Properties - Microsoft.Dynamics365.UIAutomation.Browser - Microsoft.Dynamics365.UIAutomation.Browser - v4.6 - 512 - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 7.2 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + net6.0;net462;netcoreapp3.1 + false 7.2 - - false - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - ..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll - - - ..\packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Resources.resx True True - + + + + + - - + + + + + + + + + + - + ResXFileCodeGenerator Resources.Designer.cs - - + + + + + + \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/Properties/Resources.Designer.cs b/Microsoft.Dynamics365.UIAutomation.Browser/Properties/Resources.Designer.cs index 348d3562..1854006f 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/Properties/Resources.Designer.cs +++ b/Microsoft.Dynamics365.UIAutomation.Browser/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.Dynamics365.UIAutomation.Browser.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -61,7 +61,10 @@ internal Resources() { } /// - /// Looks up a localized string similar to if (typeof (Recorder) === "undefined") { Recorder = { __namespace: true } } + /// Looks up a localized string similar to // Copyright (c) Microsoft Corporation. All rights reserved. + ///// Licensed under the MIT license. + /// + ///if (typeof (Recorder) === "undefined") { Recorder = { __namespace: true } } /// ///Recorder.ELEMENT_NODE = 1; /// @@ -71,9 +74,7 @@ internal Resources() { /// if (document.addEventListener) { /// document.addEventListener('mouseup', Recorder.clickHandler, false); /// document.addEventListener('keypress', Recorder.keyHandler, false); - /// document.addEventListener('change', Recorder.changeHandler, false); - /// } - /// else if ( [rest of string was truncated]";. + /// [rest of string was truncated]";. /// internal static string Recorder { get { diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/packages.config b/Microsoft.Dynamics365.UIAutomation.Browser/packages.config deleted file mode 100644 index 2abb7554..00000000 --- a/Microsoft.Dynamics365.UIAutomation.Browser/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj b/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj index f218872b..af511ac1 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj @@ -1,274 +1,46 @@ - - + - Debug - AnyCPU - {A075B87E-DCA5-4A2A-909B-932E2F5F98B4} - Library - Properties - Microsoft.Dynamics365.UIAutomation.Sample - Microsoft.Dynamics365.UIAutomation.Sample - v4.6 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 7.2 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + net6.0 + false 7.2 - - - ..\packages\Microsoft.ApplicationInsights.2.11.0\lib\net46\Microsoft.ApplicationInsights.dll - - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - True - - - - ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll - - - - ..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll - - - - ..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll - - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll - - - - ..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll - - - ..\packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll - - - - - - False - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - Designer - - - - Designer - - - + + + + + + + + + + + + + + + - - - {afcb5bb5-4512-4019-a911-5d56cff4f3d0} - Microsoft.Dynamics365.UIAutomation.Api.UCI - - - {dfe2c141-f1aa-4d4b-8df8-0fb93023cf45} - Microsoft.Dynamics365.UIAutomation.Api - - - {c9748803-f3cb-4531-b313-bc24d4d0bf0c} - Microsoft.Dynamics365.UIAutomation.Browser - + + + + + @@ -287,22 +59,6 @@ - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/app.config b/Microsoft.Dynamics365.UIAutomation.Sample/app.config index c2d7bc7a..02036891 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/app.config +++ b/Microsoft.Dynamics365.UIAutomation.Sample/app.config @@ -2,18 +2,6 @@ - - - - - - - - - - - - @@ -28,47 +16,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/packages.config b/Microsoft.Dynamics365.UIAutomation.Sample/packages.config deleted file mode 100644 index 13fc49ab..00000000 --- a/Microsoft.Dynamics365.UIAutomation.Sample/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file