Skip to content

Commit f626b1a

Browse files
authored
Merge branch 'trunk' into renovate/major-dotnet-azure-ad-identitymodel-extensions-monorepo
2 parents b74816a + 534fcf3 commit f626b1a

File tree

105 files changed

+3712
-3510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3712
-3510
lines changed

examples/dotnet/SeleniumDocs/BiDi/CDP/NetworkTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
using OpenQA.Selenium;
55
using OpenQA.Selenium.DevTools;
66
using System.Linq;
7-
using OpenQA.Selenium.DevTools.V126.Network;
8-
using OpenQA.Selenium.DevTools.V126.Performance;
7+
using OpenQA.Selenium.DevTools.V127.Network;
8+
using OpenQA.Selenium.DevTools.V127.Performance;
99

1010

1111
namespace SeleniumDocs.BiDi.CDP
@@ -16,7 +16,7 @@ public class NetworkTest : BaseTest
1616
[TestInitialize]
1717
public void Startup()
1818
{
19-
StartDriver("126");
19+
StartDriver("127");
2020
}
2121

2222
[TestMethod]
@@ -109,9 +109,9 @@ public async Task PerformanceMetrics()
109109
driver.Url = "https://www.selenium.dev/selenium/web/frameset.html";
110110

111111
var session = ((IDevTools)driver).GetDevToolsSession();
112-
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V126.DevToolsSessionDomains>();
112+
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V127.DevToolsSessionDomains>();
113113

114-
await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V126.Performance.EnableCommandSettings());
114+
await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V127.Performance.EnableCommandSettings());
115115
var metricsResponse =
116116
await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
117117
new GetMetricsCommandSettings()
@@ -130,8 +130,8 @@ await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
130130
public async Task SetCookie()
131131
{
132132
var session = ((IDevTools)driver).GetDevToolsSession();
133-
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V126.DevToolsSessionDomains>();
134-
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V126.Network.EnableCommandSettings());
133+
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V127.DevToolsSessionDomains>();
134+
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V127.Network.EnableCommandSettings());
135135

136136
var cookieCommandSettings = new SetCookieCommandSettings
137137
{
Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,69 @@
1+
using System;
2+
using System.Drawing;
13
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using OpenQA.Selenium;
5+
using OpenQA.Selenium.Chrome;
6+
27

38
namespace SeleniumDocs.Elements
49
{
510
[TestClass]
6-
public class InformationTest : BaseTest
11+
public class InformationTest
712
{
13+
[TestMethod]
14+
public void TestInformationCommands(){
15+
WebDriver driver = new ChromeDriver();
16+
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500);
17+
18+
// Navigate to Url
19+
driver.Url= "https://www.selenium.dev/selenium/web/inputs.html";
20+
// isDisplayed
21+
// Get boolean value for is element display
22+
bool isEmailVisible = driver.FindElement(By.Name("email_input")).Displayed;
23+
Assert.AreEqual(isEmailVisible, true);
24+
25+
//isEnabled
26+
//returns true if element is enabled else returns false
27+
bool isEnabledButton = driver.FindElement(By.Name("button_input")).Enabled;
28+
Assert.AreEqual(isEnabledButton, true);
29+
30+
//isSelected
31+
//returns true if element is checked else returns false
32+
bool isSelectedCheck = driver.FindElement(By.Name("checkbox_input")).Selected;
33+
Assert.AreEqual(isSelectedCheck, true);
34+
35+
//TagName
36+
//returns TagName of the element
37+
string tagNameInp = driver.FindElement(By.Name("email_input")).TagName;
38+
Assert.AreEqual(tagNameInp, "input");
39+
40+
//Get Location and Size
41+
//Get Location
42+
IWebElement rangeElement = driver.FindElement(By.Name("range_input"));
43+
Point point = rangeElement.Location;
44+
Assert.IsNotNull(point.X);
45+
//Get Size
46+
int height=rangeElement.Size.Height;
47+
Assert.IsNotNull(height);
48+
49+
// Retrieves the computed style property 'font-size' of field
50+
string cssValue = driver.FindElement(By.Name("color_input")).GetCssValue("font-size");
51+
Assert.AreEqual(cssValue, "13.3333px");
52+
53+
//GetText
54+
// Retrieves the text of the element
55+
string text = driver.FindElement(By.TagName("h1")).Text;
56+
Assert.AreEqual(text, "Testing Inputs");
57+
58+
//FetchAttributes
59+
//identify the email text box
60+
IWebElement emailTxt = driver.FindElement(By.Name("email_input"));
61+
//fetch the value property associated with the textbox
62+
string valueInfo = emailTxt.GetAttribute("value");
63+
Assert.AreEqual(valueInfo, "admin@localhost");
64+
65+
//Quit the driver
66+
driver.Quit();
67+
}
868
}
969
}

examples/dotnet/SeleniumDocs/SeleniumDocs.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<ItemGroup>
99
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
1010
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.0.1" />
11-
<PackageReference Include="MSTest.TestAdapter" Version="3.5.0" />
12-
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="3.5.1" />
12+
<PackageReference Include="MSTest.TestFramework" Version="3.5.1" />
1313
<PackageReference Include="Selenium.Support" Version="4.23.0" />
1414
<PackageReference Include="Selenium.WebDriver" Version="4.23.0" />
1515
</ItemGroup>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package dev.selenium.bidirectional.webdriver_bidi.high_level;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.Test;
6+
import org.openqa.selenium.By;
7+
import org.openqa.selenium.bidi.log.ConsoleLogEntry;
8+
import org.openqa.selenium.bidi.log.JavascriptLogEntry;
9+
import org.openqa.selenium.firefox.FirefoxDriver;
10+
import org.openqa.selenium.firefox.FirefoxOptions;
11+
import org.openqa.selenium.remote.RemoteWebDriver;
12+
13+
import dev.selenium.BaseTest;
14+
15+
import java.util.concurrent.CompletableFuture;
16+
import java.util.concurrent.CopyOnWriteArrayList;
17+
import java.util.concurrent.ExecutionException;
18+
import java.util.concurrent.TimeUnit;
19+
import java.util.concurrent.TimeoutException;
20+
21+
class LogTest extends BaseTest {
22+
23+
@BeforeEach
24+
public void setup() {
25+
FirefoxOptions options = new FirefoxOptions();
26+
options.setCapability("webSocketUrl", true);
27+
driver = new FirefoxDriver(options);
28+
}
29+
30+
@Test
31+
void canAddConsoleMessageHandler()
32+
throws ExecutionException, InterruptedException, TimeoutException {
33+
CompletableFuture<ConsoleLogEntry> future = new CompletableFuture<>();
34+
35+
long id = ((RemoteWebDriver) driver).script().addConsoleMessageHandler(future::complete);
36+
37+
driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
38+
driver.findElement(By.id("consoleLog")).click();
39+
40+
ConsoleLogEntry logEntry = future.get(5, TimeUnit.SECONDS);
41+
42+
Assertions.assertEquals("Hello, world!", logEntry.getText());
43+
44+
((RemoteWebDriver) driver).script().removeConsoleMessageHandler(id);
45+
}
46+
47+
@Test
48+
void canRemoveConsoleMessageHandler() {
49+
CopyOnWriteArrayList<ConsoleLogEntry> logs = new CopyOnWriteArrayList<>();
50+
51+
driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
52+
53+
long id = ((RemoteWebDriver) driver).script().addConsoleMessageHandler(logs::add);
54+
((RemoteWebDriver) driver).script().removeConsoleMessageHandler(id);
55+
56+
driver.findElement(By.id("consoleLog")).click();
57+
58+
Assertions.assertEquals(0, logs.size());
59+
}
60+
61+
@Test
62+
void canAddJsErrorHandler() throws ExecutionException, InterruptedException, TimeoutException {
63+
CompletableFuture<JavascriptLogEntry> future = new CompletableFuture<>();
64+
65+
long id = ((RemoteWebDriver) driver).script().addJavaScriptErrorHandler(future::complete);
66+
67+
driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
68+
driver.findElement(By.id("jsException")).click();
69+
70+
JavascriptLogEntry logEntry = future.get(5, TimeUnit.SECONDS);
71+
72+
Assertions.assertEquals("Error: Not working", logEntry.getText());
73+
74+
((RemoteWebDriver) driver).script().removeJavaScriptErrorHandler(id);
75+
}
76+
77+
@Test
78+
void canRemoveJsErrorHandler() {
79+
CopyOnWriteArrayList<JavascriptLogEntry> logs = new CopyOnWriteArrayList<>();
80+
81+
long id = ((RemoteWebDriver) driver).script().addJavaScriptErrorHandler(logs::add);
82+
((RemoteWebDriver) driver).script().removeJavaScriptErrorHandler(id);
83+
84+
driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
85+
driver.findElement(By.id("jsException")).click();
86+
87+
Assertions.assertEquals(0, logs.size());
88+
}
89+
}
Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
1-
const { By, Key, Browser} = require('selenium-webdriver')
2-
const { suite } = require('selenium-webdriver/testing')
1+
const { By, Key, Browser, Builder} = require('selenium-webdriver')
32
const assert = require('assert')
43

5-
suite(function(env) {
6-
describe('Actions API - Pause and Release All Actions', function() {
7-
let driver
4+
describe('Actions API - Pause and Release All Actions', function() {
5+
let driver
86

9-
before(async function() {
10-
driver = await env.builder().build()
11-
})
7+
before(async function() {
8+
driver = await new Builder().forBrowser('chrome').build();
9+
})
1210

13-
after(() => driver.quit())
11+
after(() => driver.quit())
1412

15-
it('Pause', async function() {
16-
await driver.get('https://selenium.dev/selenium/web/mouse_interaction.html')
13+
it('Pause', async function() {
14+
await driver.get('https://selenium.dev/selenium/web/mouse_interaction.html')
1715

18-
const start = Date.now()
16+
const start = Date.now()
1917

20-
const clickable = await driver.findElement(By.id('clickable'))
21-
await driver.actions()
22-
.move({ origin: clickable })
23-
.pause(1000)
24-
.press()
25-
.pause(1000)
26-
.sendKeys('abc')
27-
.perform()
18+
const clickable = await driver.findElement(By.id('clickable'))
19+
await driver.actions()
20+
.move({ origin: clickable })
21+
.pause(1000)
22+
.press()
23+
.pause(1000)
24+
.sendKeys('abc')
25+
.perform()
2826

29-
const end = Date.now() - start
30-
assert.ok(end > 2000)
31-
assert.ok(end < 4000)
32-
})
27+
const end = Date.now() - start
28+
assert.ok(end > 2000)
29+
assert.ok(end < 4000)
30+
})
3331

34-
it('Clear', async function() {
35-
await driver.get('https://selenium.dev/selenium/web/mouse_interaction.html')
32+
it('Clear', async function() {
33+
await driver.get('https://selenium.dev/selenium/web/mouse_interaction.html')
3634

37-
const clickable = driver.findElement(By.id('clickable'))
38-
await driver.actions()
39-
.click(clickable)
40-
.keyDown(Key.SHIFT)
41-
.sendKeys('a')
42-
.perform()
35+
const clickable = driver.findElement(By.id('clickable'))
36+
await driver.actions()
37+
.click(clickable)
38+
.keyDown(Key.SHIFT)
39+
.sendKeys('a')
40+
.perform()
4341

44-
await driver.actions().clear()
45-
await driver.actions().sendKeys('a').perform()
42+
await driver.actions().clear()
43+
await driver.actions().sendKeys('a').perform()
4644

47-
const value = await clickable.getAttribute('value')
48-
assert.deepStrictEqual('A', value.substring(0, 1))
49-
assert.deepStrictEqual('a', value.substring(1, 2))
50-
})
45+
const value = await clickable.getAttribute('value')
46+
assert.deepStrictEqual('A', value.substring(0, 1))
47+
assert.deepStrictEqual('a', value.substring(1, 2))
5148
})
52-
}, { browsers: [Browser.CHROME]})
49+
})

0 commit comments

Comments
 (0)