Skip to content

Commit

Permalink
Merge branch 'trunk' into renovate/kotlin-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
harsha509 authored Dec 17, 2024
2 parents 149a43f + 47280ab commit 3729158
Show file tree
Hide file tree
Showing 46 changed files with 355 additions and 501 deletions.
14 changes: 7 additions & 7 deletions examples/dotnet/SeleniumDocs/BiDi/CDP/NetworkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using OpenQA.Selenium;
using OpenQA.Selenium.DevTools;
using System.Linq;
using OpenQA.Selenium.DevTools.V130.Network;
using OpenQA.Selenium.DevTools.V130.Performance;
using OpenQA.Selenium.DevTools.V131.Network;
using OpenQA.Selenium.DevTools.V131.Performance;


namespace SeleniumDocs.BiDi.CDP
Expand All @@ -16,7 +16,7 @@ public class NetworkTest : BaseTest
[TestInitialize]
public void Startup()
{
StartDriver("130");
StartDriver("131");
}

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

var session = ((IDevTools)driver).GetDevToolsSession();
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V130.DevToolsSessionDomains>();
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V131.DevToolsSessionDomains>();

await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V130.Performance.EnableCommandSettings());
await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V131.Performance.EnableCommandSettings());
var metricsResponse =
await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
new GetMetricsCommandSettings()
Expand All @@ -130,8 +130,8 @@ await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
public async Task SetCookie()
{
var session = ((IDevTools)driver).GetDevToolsSession();
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V130.DevToolsSessionDomains>();
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V130.Network.EnableCommandSettings());
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V131.DevToolsSessionDomains>();
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V131.Network.EnableCommandSettings());

var cookieCommandSettings = new SetCookieCommandSettings
{
Expand Down
2 changes: 1 addition & 1 deletion examples/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {

dependencies {
testImplementation 'org.seleniumhq.selenium:selenium-java:4.27.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
}

test {
Expand Down
2 changes: 1 addition & 1 deletion examples/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.3</version>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@ public void setup() {
driver = new FirefoxDriver(options);
}

@Test
public void jsErrors() {
CopyOnWriteArrayList<ConsoleLogEntry> logs = new CopyOnWriteArrayList<>();

try (LogInspector logInspector = new LogInspector(driver)) {
logInspector.onConsoleEntry(logs::add);
}

driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
driver.findElement(By.id("consoleLog")).click();

new WebDriverWait(driver, Duration.ofSeconds(5)).until(_d -> !logs.isEmpty());
Assertions.assertEquals("Hello, world!", logs.get(0).getText());
}

@Test
void testListenToConsoleLog() throws ExecutionException, InterruptedException, TimeoutException {
try (LogInspector logInspector = new LogInspector(driver)) {
Expand Down
12 changes: 12 additions & 0 deletions examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,16 @@ public void setContext() {

driver.quit();
}

@Test
public void firefoxProfile() {
FirefoxProfile profile = new FirefoxProfile();
FirefoxOptions options = new FirefoxOptions();
profile.setPreference("javascript.enabled", "False");
options.setProfile(profile);

driver = new FirefoxDriver(options);

driver.quit();
}
}
2 changes: 1 addition & 1 deletion examples/kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<slf4j.version>2.0.16</slf4j.version>
<logback.version>1.5.12</logback.version>

<junit5.version>5.11.3</junit5.version>
<junit5.version>5.11.4</junit5.version>
<wdm.version>5.2.3</wdm.version>

<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
Expand Down
14 changes: 14 additions & 0 deletions examples/python/tests/browsers/test_firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,17 @@ def test_set_context(firefox_driver):

# Check if the context is back to content
assert driver.execute("GET_CONTEXT")["value"] == "content"


def test_firefox_profile():
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

options = Options()
firefox_profile = FirefoxProfile()
firefox_profile.set_preference("javascript.enabled", False)
options.profile = firefox_profile

driver = webdriver.Firefox(options=options)

driver.quit()
45 changes: 45 additions & 0 deletions examples/python/tests/elements/test_information.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
from selenium import webdriver
from selenium.webdriver.common.by import By

import pytest


def test_informarion():
# Initialize WebDriver
driver = webdriver.Chrome()
driver.implicitly_wait(0.5)

driver.get("https://www.selenium.dev/selenium/web/inputs.html")

# isDisplayed
is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed()
assert is_email_visible == True

# isEnabled
is_enabled_button = driver.find_element(By.NAME, "button_input").is_enabled()
assert is_enabled_button == True

# isSelected
is_selected_check = driver.find_element(By.NAME, "checkbox_input").is_selected()
assert is_selected_check == True

# TagName
tag_name_inp = driver.find_element(By.NAME, "email_input").tag_name
assert tag_name_inp == "input"

# GetRect
rect = driver.find_element(By.NAME, "range_input").rect
assert rect["x"] == 10

# CSS Value
css_value = driver.find_element(By.NAME, "color_input").value_of_css_property(
"font-size"
)
assert css_value == "13.3333px"

# GetText
text = driver.find_element(By.TAG_NAME, "h1").text
assert text == "Testing Inputs"

# FetchAttributes
email_txt = driver.find_element(By.NAME, "email_input")
value_info = email_txt.get_attribute("value")
assert value_info == "admin@localhost"
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_virtual_authenticator_options():
assert len(options.to_dict()) == 6


def test_create_authenticator(driver):
def test_add_authenticator(driver):
# Create virtual authenticator options
options = VirtualAuthenticatorOptions()
options.protocol = VirtualAuthenticatorOptions.Protocol.U2F
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_create_and_add_resident_key(driver):
privatekey = urlsafe_b64decode(BASE64__ENCODED_PK)
sign_count = 0

# create a resident credential using above parameters
# create a resident credential using above parameters
resident_credential = Credential.create_resident_credential(credential_id, rp_id, user_handle, privatekey, sign_count)

# add the credential created to virtual authenticator
Expand Down
18 changes: 9 additions & 9 deletions examples/ruby/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ GEM
ast (2.4.2)
base64 (0.2.0)
diff-lcs (1.5.1)
json (2.7.5)
json (2.9.0)
language_server-protocol (3.17.0.3)
logger (1.6.1)
parallel (1.26.3)
parser (3.3.5.0)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
regexp_parser (2.9.3)
rexml (3.3.9)
rspec (3.13.0)
rspec-core (~> 3.13.0)
Expand All @@ -29,19 +29,19 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.0)
rubocop (1.68.0)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.33.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-rspec (3.2.0)
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
rubyzip (2.3.2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Listen to the `console.log` events and register callbacks to process the event.
{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L31-L38" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L33-L39" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand All @@ -36,7 +36,7 @@ and register callbacks to process the exception details.

{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L70-L77" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L73-L78" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand All @@ -56,7 +56,7 @@ Listen to all JS logs at all levels and register callbacks to process the log.
{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L52-L59" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L55-L60" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Listen to the `console.log` events and register callbacks to process the event.
{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L31-L38" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L33-L39" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand All @@ -42,7 +42,7 @@ and register callbacks to process the exception details.

{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L70-L77" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L73-L78" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand All @@ -62,7 +62,7 @@ Listen to all JS logs at all levels and register callbacks to process the log.
{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L52-L59" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L55-L60" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Listen to the `console.log` events and register callbacks to process the event.
{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L31-L38" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L33-L39" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand All @@ -42,7 +42,7 @@ and register callbacks to process the exception details.

{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L70-L77" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L73-L78" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand All @@ -62,7 +62,7 @@ Listen to all JS logs at all levels and register callbacks to process the log.
{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L52-L59" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L55-L60" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Listen to the `console.log` events and register callbacks to process the event.

{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L31-L38" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L33-L39" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/javascript/test/bidirectional/logInspector.spec.js#L23-37" >}}
{{< /tab >}}
{{< tab header="Kotlin" >}}
Expand All @@ -43,13 +43,12 @@ and register callbacks to process the exception details.

{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L70-L77" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L73-L78" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/javascript/test/bidirectional/logInspector.spec.js#L44-54" >}}
{{< /tab >}}
{{< tab header="Kotlin" >}}
Expand All @@ -63,7 +62,8 @@ Listen to all JS logs at all levels and register callbacks to process the log.

{{< tabpane text=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L52-L59" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java#L55-L60" >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
Expand Down
Loading

0 comments on commit 3729158

Please sign in to comment.