-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Release 4.22 Updates #1765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Release 4.22 Updates #1765
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6c99615
Blog post - still needs examples links
titusfortner 603cb0c
update version and links in downloads
titusfortner f068e27
[examples] reorganize code examples for BiDi
titusfortner 15060fb
[examples] update Ruby BiDi code
titusfortner bd868a3
[examples] update Python examples
titusfortner 4efd49d
update code examples
titusfortner b68d0b8
more example updates
titusfortner b130f8e
update all BiDi documentation
titusfortner fbaabc6
update links to bidi documentation
titusfortner b769019
wrong github reference
titusfortner 738629d
restore java and javascript low level bidi examples
titusfortner bd7f5d0
Merge branch 'trunk' into 4_22
pujagani 02b3af6
Merge branch 'trunk' into 4_22
diemol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
examples/dotnet/SeleniumDocs/BiDi/CDP/CDPTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| using System.Collections.Generic; | ||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| using OpenQA.Selenium; | ||
| using OpenQA.Selenium.Chrome; | ||
|
|
||
| namespace SeleniumDocs.BiDi.CDP | ||
| { | ||
| [TestClass] | ||
| public class CDPTest : BaseChromeTest | ||
| { | ||
| [TestMethod] | ||
| public void SetCookie() | ||
| { | ||
| var cookie = new Dictionary<string, object> | ||
| { | ||
| { "name", "cheese" }, | ||
| { "value", "gouda" }, | ||
| { "domain", "www.selenium.dev" }, | ||
| { "secure", true } | ||
| }; | ||
| ((ChromeDriver)driver).ExecuteCdpCommand("Network.setCookie", cookie); | ||
|
|
||
| driver.Url = "https://www.selenium.dev"; | ||
| Cookie cheese = driver.Manage().Cookies.GetCookieNamed("cheese"); | ||
| Assert.AreEqual("gouda", cheese.Value); | ||
|
|
||
| } | ||
| } | ||
| } |
56 changes: 56 additions & 0 deletions
examples/dotnet/SeleniumDocs/BiDi/CDP/LoggingTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.IdentityModel.Tokens; | ||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| using OpenQA.Selenium; | ||
| using OpenQA.Selenium.Support.UI; | ||
|
|
||
| namespace SeleniumDocs.BiDi.CDP | ||
| { | ||
| [TestClass] | ||
| public class LoggingTest : BaseChromeTest | ||
| { | ||
| [TestMethod] | ||
| public async Task ConsoleLogs() | ||
| { | ||
| driver.Url = "https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html"; | ||
|
|
||
| using IJavaScriptEngine monitor = new JavaScriptEngine(driver); | ||
| var messages = new List<string>(); | ||
| monitor.JavaScriptConsoleApiCalled += (_, e) => | ||
| { | ||
| messages.Add(e.MessageContent); | ||
| }; | ||
| await monitor.StartEventMonitoring(); | ||
|
|
||
| driver.FindElement(By.Id("consoleLog")).Click(); | ||
| driver.FindElement(By.Id("consoleError")).Click(); | ||
| new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(_ => messages.Count > 1); | ||
| monitor.StopEventMonitoring(); | ||
|
|
||
| Assert.IsTrue(messages.Contains("Hello, world!")); | ||
| Assert.IsTrue(messages.Contains("I am console error")); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task JsErrors() | ||
| { | ||
| driver.Url = "https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html"; | ||
|
|
||
| using IJavaScriptEngine monitor = new JavaScriptEngine(driver); | ||
| var messages = new List<string>(); | ||
| monitor.JavaScriptExceptionThrown += (_, e) => | ||
| { | ||
| messages.Add(e.Message); | ||
| }; | ||
| await monitor.StartEventMonitoring(); | ||
|
|
||
| driver.FindElement(By.Id("jsException")).Click(); | ||
| new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(_ => !messages.IsNullOrEmpty()); | ||
| monitor.StopEventMonitoring(); | ||
|
|
||
| Assert.IsTrue(messages.Contains("Uncaught")); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
examples/dotnet/SeleniumDocs/BiDi/CDP/ScriptTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.IdentityModel.Tokens; | ||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| using OpenQA.Selenium; | ||
| using OpenQA.Selenium.Support.UI; | ||
|
|
||
| namespace SeleniumDocs.BiDi.CDP | ||
| { | ||
| [TestClass] | ||
| public class ScriptTest : BaseChromeTest | ||
| { | ||
| [TestMethod] | ||
| public async Task PinScript() | ||
| { | ||
| driver.Url = "https://www.selenium.dev/selenium/web/xhtmlTest.html"; | ||
| var element = driver.FindElement(By.Id("id1")); | ||
|
|
||
| var key = await new JavaScriptEngine(driver).PinScript("return arguments;"); | ||
| var arguments = ((WebDriver)driver).ExecuteScript(key, 1, true, element); | ||
|
|
||
| var expected = new List<object> | ||
| { | ||
| 1L, | ||
| true, | ||
| element | ||
| }; | ||
| CollectionAssert.AreEqual(expected, (ICollection)arguments); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task MutatedElements() | ||
| { | ||
| driver.Url = "https://www.selenium.dev/selenium/web/dynamic.html"; | ||
| var mutations = new List<IWebElement>(); | ||
|
|
||
| using IJavaScriptEngine monitor = new JavaScriptEngine(driver); | ||
| monitor.DomMutated += (_, e) => | ||
| { | ||
| var locator = By.CssSelector($"*[data-__webdriver_id='{e.AttributeData.TargetId}']"); | ||
| mutations.Add(driver.FindElement(locator)); | ||
| }; | ||
| await monitor.StartEventMonitoring(); | ||
| await monitor.EnableDomMutationMonitoring(); | ||
|
|
||
| driver.FindElement(By.Id("reveal")).Click(); | ||
|
|
||
| new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(_ => !mutations.IsNullOrEmpty()); | ||
| await monitor.DisableDomMutationMonitoring(); | ||
| monitor.StopEventMonitoring(); | ||
|
|
||
| var revealed = driver.FindElement(By.Id("revealed")); | ||
| Assert.AreEqual(revealed, mutations[0]); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.