Skip to content

Commit 49cfbff

Browse files
authored
Merge branch 'trunk' into oscs_fix_cg1npooau51v46pfk2d0
2 parents f7a2d6f + a1f805f commit 49cfbff

11 files changed

Lines changed: 60 additions & 26 deletions

File tree

.github/workflows/build-selenium-manager.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: "[Windows] Build selenium-manager"
88
runs-on: windows-latest
99
env:
10-
RUSTFLAGS: '-C target-feature=+crt-static'
10+
RUSTFLAGS: '-Ctarget-feature=+crt-static'
1111
steps:
1212
- name: "Checkout project"
1313
uses: actions/checkout@v3
@@ -30,21 +30,26 @@ jobs:
3030
name: "[Linux] Build selenium-manager"
3131
runs-on: ubuntu-latest
3232
env:
33-
RUSTFLAGS: '-C target-feature=+crt-static'
33+
RUSTFLAGS: '-Ctarget-feature=-crt-static'
3434
steps:
3535
- name: "Checkout project"
3636
uses: actions/checkout@v3
3737
- name: "Update Rust"
3838
run: |
3939
rustup update
4040
rustc -vV
41+
- name: "Install zig"
42+
run: |
43+
sudo snap install zig --beta --classic
4144
- name: "Build release"
4245
run: |
4346
cd rust
44-
cargo build --release --target x86_64-unknown-linux-gnu
47+
cargo install cargo-zigbuild
48+
rustup target add x86_64-unknown-linux-musl
49+
cargo zigbuild --release --target x86_64-unknown-linux-musl
4550
- name: "Tar binary (to keep executable permission)"
4651
run: |
47-
cd rust/target/x86_64-unknown-linux-gnu/release
52+
cd rust/target/x86_64-unknown-linux-musl/release
4853
tar -cvf ../../../../selenium-manager.tar selenium-manager
4954
- name: "Upload binary"
5055
uses: actions/upload-artifact@v3
@@ -57,7 +62,7 @@ jobs:
5762
name: "[macOS] Build selenium-manager"
5863
runs-on: macos-latest
5964
env:
60-
RUSTFLAGS: '-C target-feature=+crt-static'
65+
RUSTFLAGS: '-Ctarget-feature=+crt-static'
6166
steps:
6267
- name: "Checkout project"
6368
uses: actions/checkout@v3

dotnet/src/webdriver/InvalidSelectorException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace OpenQA.Selenium
2525
/// The exception that is thrown when an element is not visible.
2626
/// </summary>
2727
[Serializable]
28-
public class InvalidSelectorException : NoSuchElementException
28+
public class InvalidSelectorException : WebDriverException
2929
{
3030
/// <summary>
3131
/// Initializes a new instance of the <see cref="InvalidSelectorException"/> class.

dotnet/test/common/ElementFindingTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void ShouldNotBeAbleToLocateByIdMultipleElementsThatDoNotExist()
8484
public void FindingASingleElementByEmptyIdShouldThrow()
8585
{
8686
driver.Url = formsPage;
87-
Assert.That(() => driver.FindElement(By.Id("")), Throws.InstanceOf<NoSuchElementException>());
87+
Assert.That(() => driver.FindElement(By.Id("")), Throws.InstanceOf<WebDriverException>());
8888
}
8989

9090
[Test]
@@ -222,7 +222,7 @@ public void ShouldNotBeAbleToLocateByTagNameMultipleElementsThatDoNotExist()
222222
public void FindingASingleElementByEmptyTagNameShouldThrow()
223223
{
224224
driver.Url = formsPage;
225-
Assert.That(() => driver.FindElement(By.TagName("")), Throws.InstanceOf<NoSuchElementException>());
225+
Assert.That(() => driver.FindElement(By.TagName("")), Throws.InstanceOf<WebDriverException>());
226226
}
227227

228228
[Test]
@@ -312,14 +312,14 @@ public void ShouldNotFindElementByClassWhenTheNameQueriedIsShorterThanCandidateN
312312
public void FindingASingleElementByEmptyClassNameShouldThrow()
313313
{
314314
driver.Url = xhtmlTestPage;
315-
Assert.That(() => driver.FindElement(By.ClassName("")), Throws.InstanceOf<NoSuchElementException>());
315+
Assert.That(() => driver.FindElement(By.ClassName("")), Throws.InstanceOf<WebDriverException>());
316316
}
317317

318318
[Test]
319319
public void FindingMultipleElementsByEmptyClassNameShouldThrow()
320320
{
321321
driver.Url = xhtmlTestPage;
322-
Assert.That(() => driver.FindElements(By.ClassName("")), Throws.InstanceOf<NoSuchElementException>());
322+
Assert.That(() => driver.FindElements(By.ClassName("")), Throws.InstanceOf<WebDriverException>());
323323
}
324324

325325
[Test]
@@ -600,28 +600,28 @@ public void ShouldNotFindElementsByCssSelectorWhenThereIsNoSuchElement()
600600
public void FindingASingleElementByEmptyCssSelectorShouldThrow()
601601
{
602602
driver.Url = xhtmlTestPage;
603-
Assert.That(() => driver.FindElement(By.CssSelector("")), Throws.InstanceOf<NoSuchElementException>());
603+
Assert.That(() => driver.FindElement(By.CssSelector("")), Throws.InstanceOf<WebDriverException>());
604604
}
605605

606606
[Test]
607607
public void FindingMultipleElementsByEmptyCssSelectorShouldThrow()
608608
{
609609
driver.Url = xhtmlTestPage;
610-
Assert.That(() => driver.FindElements(By.CssSelector("")), Throws.InstanceOf<NoSuchElementException>());
610+
Assert.That(() => driver.FindElements(By.CssSelector("")), Throws.InstanceOf<WebDriverException>());
611611
}
612612

613613
[Test]
614614
public void FindingASingleElementByInvalidCssSelectorShouldThrow()
615615
{
616616
driver.Url = xhtmlTestPage;
617-
Assert.That(() => driver.FindElement(By.CssSelector("//a/b/c[@id='1']")), Throws.InstanceOf<NoSuchElementException>());
617+
Assert.That(() => driver.FindElement(By.CssSelector("//a/b/c[@id='1']")), Throws.InstanceOf<WebDriverException>());
618618
}
619619

620620
[Test]
621621
public void FindingMultipleElementsByInvalidCssSelectorShouldThrow()
622622
{
623623
driver.Url = xhtmlTestPage;
624-
Assert.That(() => driver.FindElements(By.CssSelector("//a/b/c[@id='1']")), Throws.InstanceOf<NoSuchElementException>());
624+
Assert.That(() => driver.FindElements(By.CssSelector("//a/b/c[@id='1']")), Throws.InstanceOf<WebDriverException>());
625625
}
626626

627627
// By.linkText positive

java/src/org/openqa/selenium/firefox/FirefoxDriver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ public Optional<DevTools> maybeGetDevTools() {
291291
/**
292292
* @deprecated Use W3C-compliant BiDi protocol. Use {{@link #getBiDi()}}
293293
*/
294+
@Deprecated
294295
@Override
295296
public DevTools getDevTools() {
296297
if (!cdpUri.isPresent()) {

java/src/org/openqa/selenium/grid/node/config/SessionCapabilitiesMutator.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.openqa.selenium.Capabilities;
2323
import org.openqa.selenium.ImmutableCapabilities;
2424
import org.openqa.selenium.PersistentCapabilities;
25+
2526
import java.util.ArrayList;
2627
import java.util.HashMap;
2728
import java.util.List;
@@ -56,6 +57,10 @@ public Capabilities apply(Capabilities capabilities) {
5657
return capabilities;
5758
}
5859

60+
if ("internet explorer".equalsIgnoreCase(capabilities.getBrowserName())) {
61+
return new ImmutableCapabilities(removeUnknownExtensionsForIE(capabilities));
62+
}
63+
5964
String browserName = capabilities.getBrowserName().toLowerCase();
6065
if (!BROWSER_OPTIONS.containsKey(browserName)) {
6166
return capabilities;
@@ -95,11 +100,21 @@ public Capabilities apply(Capabilities capabilities) {
95100
return slotStereotype.merge(capabilities);
96101
}
97102

103+
private Map<String, Object> removeUnknownExtensionsForIE(Capabilities capabilities) {
104+
Map<String, Object> toReturn = new HashMap<>(capabilities.asMap());
105+
capabilities.asMap().keySet()
106+
.stream()
107+
.filter(key -> key.contains(":"))
108+
.filter(key -> !"se:ieOptions".equalsIgnoreCase(key))
109+
.forEach(toReturn::remove);
110+
return toReturn;
111+
}
112+
98113
private Map<String, Object> mergeChromiumOptions(Map<String, Object> stereotypeOptions,
99114
Map<String, Object> capsOptions) {
100115
Map<String, Object> toReturn = new HashMap<>(stereotypeOptions);
101116

102-
for (Map.Entry<String, Object> entry : capsOptions.entrySet()) {
117+
for (Map.Entry<String, Object> entry : capsOptions.entrySet()) {
103118
String name = entry.getKey();
104119
Object value = entry.getValue();
105120
if (name.equals("args")) {

java/src/org/openqa/selenium/grid/node/docker/DockerSessionFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ private Map<String, String> getBrowserContainerEnvVars(Capabilities sessionReque
314314
// Passing env vars set to the child container
315315
Map<String, String> seEnvVars = System.getenv();
316316
seEnvVars.entrySet().stream()
317-
.filter(entry -> entry.getKey().startsWith("SE_"))
317+
.filter(entry -> entry.getKey().startsWith("SE_") ||
318+
entry.getKey().equalsIgnoreCase("LANGUAGE"))
318319
.forEach(entry -> envVars.put(entry.getKey(), entry.getValue()));
319320
return envVars;
320321
}

java/test/org/openqa/selenium/devtools/ConsoleEventsTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.openqa.selenium.devtools;
1919

20-
import static org.assertj.core.api.Assertions.assertThat;
21-
2220
import org.junit.jupiter.api.Test;
2321
import org.openqa.selenium.By;
2422
import org.openqa.selenium.devtools.events.ConsoleEvent;
@@ -32,9 +30,13 @@
3230
import java.util.concurrent.TimeUnit;
3331
import java.util.concurrent.TimeoutException;
3432

33+
import static org.assertj.core.api.Assertions.assertThat;
34+
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
35+
3536
class ConsoleEventsTest extends DevToolsTestBase {
3637

3738
@Test
39+
@Ignore(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
3840
public void canWatchConsoleEvents() throws InterruptedException, ExecutionException, TimeoutException {
3941
String page = appServer.create(
4042
new Page()
@@ -52,6 +54,7 @@ public void canWatchConsoleEvents() throws InterruptedException, ExecutionExcept
5254
}
5355

5456
@Test
57+
@Ignore(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
5558
public void canWatchConsoleEventsWithArgs() throws InterruptedException, ExecutionException, TimeoutException {
5659
String page = appServer.create(
5760
new Page()

javascript/node/selenium-webdriver/lib/webdriver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ class WebDriver {
14051405
if (requestPausedParams.request.url == httpResponse.urlToIntercept) {
14061406
connection.execute('Fetch.fulfillRequest', {
14071407
requestId: requestPausedParams['requestId'],
1408-
responseCode: 200,
1408+
responseCode: httpResponse.status,
14091409
responseHeaders: httpResponse.headers,
14101410
body: httpResponse.body,
14111411
})

py/selenium/webdriver/remote/webelement.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from base64 import encodebytes
2626
from hashlib import md5 as md5_hash
2727
from io import BytesIO
28+
from typing import List
2829

2930
from selenium.common.exceptions import JavascriptException
3031
from selenium.common.exceptions import WebDriverException
@@ -424,7 +425,7 @@ def find_element(self, by=By.ID, value=None) -> WebElement:
424425

425426
return self._execute(Command.FIND_CHILD_ELEMENT, {"using": by, "value": value})["value"]
426427

427-
def find_elements(self, by=By.ID, value=None) -> list[WebElement]:
428+
def find_elements(self, by=By.ID, value=None) -> List[WebElement]:
428429
"""Find elements given a By strategy and locator.
429430
430431
:Usage:

py/test/selenium/webdriver/common/bidi_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from selenium.webdriver.support.ui import WebDriverWait
2424

2525

26+
@pytest.mark.xfail_firefox(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
27+
@pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
2628
@pytest.mark.xfail_safari
2729
async def test_check_console_messages(driver, pages):
2830
async with driver.bidi_connection() as session:
@@ -35,6 +37,8 @@ async def test_check_console_messages(driver, pages):
3537
assert messages["message"] == "I love cheese"
3638

3739

40+
@pytest.mark.xfail_firefox(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
41+
@pytest.mark.xfail_remote(reason="https://bugzilla.mozilla.org/show_bug.cgi?id=1819965")
3842
@pytest.mark.xfail_safari
3943
async def test_check_error_console_messages(driver, pages):
4044
async with driver.bidi_connection() as session:

0 commit comments

Comments
 (0)