Skip to content

Commit

Permalink
[BiDi] JavaScript Handling (#213) +semver: feature
Browse files Browse the repository at this point in the history
* Add JavaScripHandling wrapper over JavaScriptEngine functionality

* Fix the compilation error, update the code documentation

* - Add SetAttribute JsAction
- Implement example test to handle DOM mutations

* Add localized logging values for JavaScriptHandling methods

* - Add PinnedScript extensions and element's JsActions
- Add localization logger values for new methods
- Implemented tests for PinnedScripts

* Implement all tests for JavaScriptHandling functionality:
- for adding script callback bindings
- for adding initialization scripts
- for subscribing to JS exceptions and console API calls
Also fix ScriptCallbackBindings property of IJavaScriptEngine
  • Loading branch information
mialeska authored Feb 23, 2022
1 parent a1a255c commit a676cdc
Show file tree
Hide file tree
Showing 13 changed files with 907 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<ItemGroup>
<None Remove="Resources\JavaScripts\ExpandShadowRoot.js" />
<None Remove="Resources\JavaScripts\SetAttribute.js" />
<None Remove="Resources\Localization\be.json" />
<None Remove="Resources\Localization\en.json" />
<None Remove="Resources\Localization\ru.json" />
Expand Down Expand Up @@ -62,6 +63,7 @@
<EmbeddedResource Include="Resources\JavaScripts\SetFocus.js" />
<EmbeddedResource Include="Resources\JavaScripts\SetInnerHTML.js" />
<EmbeddedResource Include="Resources\JavaScripts\OpenNewTab.js" />
<EmbeddedResource Include="Resources\JavaScripts\SetAttribute.js" />
<EmbeddedResource Include="Resources\JavaScripts\SetValue.js" />
<EmbeddedResource Include="Resources\Localization\be.json" />
<EmbeddedResource Include="Resources\Localization\en.json" />
Expand Down
210 changes: 209 additions & 1 deletion Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public Browser(WebDriver webDriver)
{
Driver = webDriver;
Network = new NetworkHandling(webDriver);
JavaScriptEngine = new JavaScriptHandling(webDriver);
Logger = AqualityServices.LocalizedLogger;
LocalizationManager = AqualityServices.Get<ILocalizationManager>();
browserProfile = AqualityServices.Get<IBrowserProfile>();
Expand All @@ -55,6 +56,11 @@ public Browser(WebDriver webDriver)
/// </summary>
public INetwork Network { get; }

/// <summary>
/// Provides JavaScript Monitoring functionality <see cref="JavaScriptHandling"/>
/// </summary>
public IJavaScriptEngine JavaScriptEngine { get; }

/// <summary>
/// Gets name of desired browser from configuration.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum JavaScript
ScrollToTop,
ScrollWindowBy,
SelectComboBoxValueByText,
SetAttribute,
SetFocus,
SetInnerHTML,
SetValue,
Expand Down
Loading

0 comments on commit a676cdc

Please sign in to comment.