Skip to content

Commit d574de1

Browse files
authored
Merge branch 'trunk' into fix-ruby-handling-of-unhandled_prompt_behavior
2 parents 4a406e0 + 38b1dd1 commit d574de1

File tree

11 files changed

+34
-27
lines changed

11 files changed

+34
-27
lines changed

dotnet/src/webdriver/InvalidSelectorException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class InvalidSelectorException : WebDriverException
3030
/// <summary>
3131
/// Link to the documentation for this error
3232
/// </summary>
33-
private static string supportUrl = baseSupportUrl + "#invalid-selector-exception";
33+
private static string supportUrl = baseSupportUrl + "#invalidselectorexception";
3434

3535
/// <summary>
3636
/// Initializes a new instance of the <see cref="InvalidSelectorException"/> class.

dotnet/src/webdriver/NoSuchElementException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class NoSuchElementException : NotFoundException
3131
/// <summary>
3232
/// Link to the documentation for this error
3333
/// </summary>
34-
private static string supportUrl = baseSupportUrl + "#no-such-element-exception";
34+
private static string supportUrl = baseSupportUrl + "#nosuchelementexception";
3535

3636
/// <summary>
3737
/// Initializes a new instance of the <see cref="NoSuchElementException"/> class.

dotnet/src/webdriver/StaleElementReferenceException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class StaleElementReferenceException : WebDriverException
3030
/// <summary>
3131
/// Link to the documentation for this error
3232
/// </summary>
33-
private static string supportUrl = baseSupportUrl + "#stale-element-reference-exception";
33+
private static string supportUrl = baseSupportUrl + "#staleelementreferenceexception";
3434

3535
/// <summary>
3636
/// Initializes a new instance of the <see cref="StaleElementReferenceException"/> class.

java/src/org/openqa/selenium/InvalidSelectorException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
public class InvalidSelectorException extends WebDriverException {
2929

30-
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "#invalid-selector-exception";
30+
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "#invalidselectorexception";
3131

3232
public InvalidSelectorException(String reason) {
3333
super(reason);

java/src/org/openqa/selenium/NoSuchElementException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@NullMarked
2828
public class NoSuchElementException extends NotFoundException {
2929

30-
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "#no-such-element-exception";
30+
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "#nosuchelementexception";
3131

3232
public NoSuchElementException(@Nullable String reason) {
3333
super(reason);

java/src/org/openqa/selenium/StaleElementReferenceException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@NullMarked
2828
public class StaleElementReferenceException extends WebDriverException {
2929

30-
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "#stale-element-reference-exception";
30+
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "#staleelementreferenceexception";
3131

3232
public StaleElementReferenceException(@Nullable String message) {
3333
super(message);

py/selenium/webdriver/common/utils.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
"""The Utils methods."""
17+
18+
"""Utility functions."""
1819

1920
import socket
21+
import urllib.request
2022
from collections.abc import Iterable
2123
from typing import Optional, Union
2224

@@ -67,8 +69,8 @@ def find_connectable_ip(host: Union[str, bytes, bytearray, None], port: Optional
6769
port are considered.
6870
6971
:Args:
70-
- host - A hostname.
71-
- port - Optional port number.
72+
- host - hostname
73+
- port - port number
7274
7375
:Returns:
7476
A single IP address, as a string. If any IPv4 address is found, one is
@@ -100,8 +102,8 @@ def join_host_port(host: str, port: int) -> str:
100102
example, _join_host_port('::1', 80) == '[::1]:80'.
101103
102104
:Args:
103-
- host - A hostname.
104-
- port - An integer port.
105+
- host - hostname or IP
106+
- port - port number
105107
"""
106108
if ":" in host and not host.startswith("["):
107109
return f"[{host}]:{port}"
@@ -112,7 +114,8 @@ def is_connectable(port: int, host: Optional[str] = "localhost") -> bool:
112114
"""Tries to connect to the server at port to see if it is running.
113115
114116
:Args:
115-
- port - The port to connect.
117+
- port - port number
118+
- host - hostname or IP
116119
"""
117120
socket_ = None
118121
try:
@@ -130,18 +133,22 @@ def is_connectable(port: int, host: Optional[str] = "localhost") -> bool:
130133
return result
131134

132135

133-
def is_url_connectable(port: Union[int, str]) -> bool:
134-
"""Tries to connect to the HTTP server at /status path and specified port
135-
to see if it responds successfully.
136+
def is_url_connectable(
137+
port: Union[int, str],
138+
host: Optional[str] = "127.0.0.1",
139+
scheme: Optional[str] = "http",
140+
) -> bool:
141+
"""Sends a request to the HTTP server at the /status endpoint to see if it
142+
responds successfully.
136143
137144
:Args:
138-
- port - The port to connect.
145+
- port - port number
146+
- host - hostname or IP
147+
- scheme - URL scheme
139148
"""
140-
from urllib import request as url_request
141-
142149
try:
143-
res = url_request.urlopen(f"http://127.0.0.1:{port}/status")
144-
return res.getcode() == 200
150+
with urllib.request.urlopen(f"{scheme}://{host}:{port}/status") as res:
151+
return res.getcode() == 200
145152
except Exception:
146153
return False
147154

rb/lib/selenium/webdriver/common/error.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def self.for_error(error)
3838
ERROR_URL = 'https://www.selenium.dev/documentation/webdriver/troubleshooting/errors'
3939

4040
URLS = {
41-
NoSuchElementError: "#{ERROR_URL}#no-such-element-exception",
42-
StaleElementReferenceError: "#{ERROR_URL}#stale-element-reference-exception",
43-
InvalidSelectorError: "#{ERROR_URL}#invalid-selector-exception",
41+
NoSuchElementError: "#{ERROR_URL}#nosuchelementexception",
42+
StaleElementReferenceError: "#{ERROR_URL}#staleelementreferenceexception",
43+
InvalidSelectorError: "#{ERROR_URL}#invalidselectorexception",
4444
NoSuchDriverError: "#{ERROR_URL}/driver_location"
4545
}.freeze
4646

rb/spec/integration/selenium/webdriver/driver_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ module WebDriver
149149
driver.navigate.to url_for('xhtmlTest.html')
150150
expect {
151151
driver.find_element(id: 'not-there')
152-
}.to raise_error(Error::NoSuchElementError, /errors#no-such-element-exception/)
152+
}.to raise_error(Error::NoSuchElementError, /errors#nosuchelementexception/)
153153
end
154154

155155
it 'raises if invalid locator',
156156
exclude: {browser: %i[safari safari_preview], reason: 'Safari TimeoutError'} do
157157
driver.navigate.to url_for('xhtmlTest.html')
158158
expect {
159159
driver.find_element(xpath: '*?//-')
160-
}.to raise_error(Error::InvalidSelectorError, /errors#invalid-selector-exception/)
160+
}.to raise_error(Error::InvalidSelectorError, /errors#invalidselectorexception/)
161161
end
162162
end
163163

rb/spec/integration/selenium/webdriver/element_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module WebDriver
4646
driver.navigate.refresh
4747

4848
expect { button.click }.to raise_exception(Error::StaleElementReferenceError,
49-
/errors#stale-element-reference-exception/)
49+
/errors#staleelementreferenceexception/)
5050

5151
reset_driver!(time: 1) if %i[safari safari_preview].include? GlobalTestEnv.browser
5252
end

0 commit comments

Comments
 (0)