Skip to content

Commit 60157c5

Browse files
authored
Merge branch 'trunk' into syber911911-feature-branch
2 parents c1da1dd + 19a4546 commit 60157c5

File tree

9 files changed

+100
-23
lines changed

9 files changed

+100
-23
lines changed

java/src/org/openqa/selenium/manager/SeleniumManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ private synchronized Path getBinary() {
194194
} else if (current.is(MAC)) {
195195
folder = "macos";
196196
} else if (current.is(LINUX)) {
197-
folder = "linux";
197+
if (System.getProperty("os.arch").contains("arm")) {
198+
throw new WebDriverException("Linux ARM is not supported by Selenium Manager");
199+
} else {
200+
folder = "linux";
201+
}
198202
} else if (current.is(UNIX)) {
199203
LOG.warning(
200204
String.format(

java/src/org/openqa/selenium/remote/http/HttpMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public String getHeader(String name) {
123123
* @return self
124124
*/
125125
public M setHeader(String name, String value) {
126-
return removeHeader(name).addHeader(name, value);
126+
return removeHeader(name.toLowerCase()).addHeader(name.toLowerCase(), value);
127127
}
128128

129129
/**
@@ -135,7 +135,7 @@ public M setHeader(String name, String value) {
135135
* @return self
136136
*/
137137
public M addHeader(String name, String value) {
138-
headers.computeIfAbsent(name, (n) -> new ArrayList<>()).add(value);
138+
headers.computeIfAbsent(name.toLowerCase(), (n) -> new ArrayList<>()).add(value);
139139
return self();
140140
}
141141

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public void canChangeUserAgent() {
4848
.collect(
4949
Collectors.toMap(cells -> cells.get(0).getText(), cells -> cells.get(1).getText()));
5050
assertThat(headers)
51-
.containsEntry("User-Agent", "Camembert 1.0")
52-
.containsEntry("Accept-Language", "da, en-gb;q=0.9, *;q=0.8");
51+
.containsEntry("user-agent", "Camembert 1.0")
52+
.containsEntry("accept-language", "da, en-gb;q=0.9, *;q=0.8");
5353

5454
Object platform =
5555
((JavascriptExecutor) driver).executeScript("return window.navigator.platform");

java/test/org/openqa/selenium/remote/http/DumpHttpExchangeFilterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void shouldIncludeRequestAndResponseHeaders() {
3434
dumpFilter.requestLogMessage(
3535
new HttpRequest(GET, "/foo").addHeader("Peas", "and Sausages"));
3636

37-
assertThat(reqLog).contains("Peas");
37+
assertThat(reqLog).contains("peas");
3838
assertThat(reqLog).contains("and Sausages");
3939

4040
String resLog =
@@ -43,7 +43,7 @@ void shouldIncludeRequestAndResponseHeaders() {
4343
.addHeader("Cheese", "Brie")
4444
.setContent(string("Hello, World!", UTF_8)));
4545

46-
assertThat(resLog).contains("Cheese");
46+
assertThat(resLog).contains("cheese");
4747
assertThat(resLog).contains("Brie");
4848
}
4949

java/test/org/openqa/selenium/remote/http/HttpMessageTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ void allHeadersAreAdded() {
4040

4141
message.getHeaderNames().forEach(headers::add);
4242

43-
assertThat(headers.contains("Content-Length")).isTrue();
44-
assertThat(headers.contains("Content-length")).isTrue();
43+
assertThat(headers.contains("Content-Length")).isFalse();
44+
assertThat(headers.contains("Content-length")).isFalse();
4545
assertThat(headers.contains("content-length")).isTrue();
4646
}
4747
}
@@ -54,7 +54,7 @@ void readingIsCaseInsensitive() {
5454
message.addHeader("Content-length", "2048");
5555
message.addHeader("content-length", "4096");
5656

57-
assertThat(message.getHeader("Content-Length")).isEqualTo("4096");
57+
assertThat(message.getHeader("Content-Length")).isEqualTo("1024");
5858
}
5959
}
6060

@@ -74,7 +74,8 @@ void replacingIsCaseInsensitive() {
7474
assertThat(message.getHeader("content-length")).isEqualTo("8192");
7575
assertThat(headers.contains("Content-Length")).isFalse();
7676
assertThat(headers.contains("Content-length")).isFalse();
77-
assertThat(headers.contains("content-length")).isFalse();
77+
assertThat(headers.contains("contenT-length")).isFalse();
78+
assertThat(headers.contains("content-length")).isTrue();
7879
}
7980
}
8081

py/docs/README.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
==========================
2+
About Python Documentation
3+
==========================
4+
5+
This directory, ``py/docs``, is the source for the API Reference Documentation
6+
and basic Python documentation as well as the main README for the GitHub and
7+
PyPI package.
8+
9+
10+
How to build docs
11+
=================
12+
13+
One can build the Python documentation without doing a full bazel build. The
14+
following instructions will build the setup a virtual environment and installs tox, clones the
15+
selenium repo and then runs ``tox -c py/tox.ini`` building the Python documentation.
16+
17+
.. code-block:: console
18+
19+
virtualenv test-py38-env
20+
source test-py38-env/bin/activate
21+
pip install tox
22+
git clone [email protected]:SeleniumHQ/selenium.git
23+
cd selenium/
24+
# uncomment and switch to your development branch if needed
25+
#git switch -c feature-branch origin/feature-branch
26+
tox -c py/tox.ini
27+
28+
Works in similar manner as the larger selenium bazel doing just the python documentation portion.
29+
30+
What is happening under the covers of tox, sphinx
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
tox is essentially a build tool for Python. Here it setups its own virtualenv and installs the
33+
documentation packages (sphinx and jinja2) as well as the required selenium python
34+
dependencies. Then tox runs the sphinx generate autodoc stub files and then builds the docs.
35+
36+
Sphinx is .. well a much larger topic then what we could cover here. Most important to say
37+
here is that the docs are using the "classic" theme and than the majority of the api documentation
38+
is autogenerated. There is plenty of information available and currently the documentation is
39+
fairly small and not complex. So some basic understanding of restructed text and the Sphinx tool chain
40+
should be sufficient to contribute and develop the Python docs.
41+
42+
To clean up the build / tox cache
43+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44+
Although there is a Sphinx Makefile option to clean up using the tox environment above one can
45+
manually clean the build by deleting the build directory on the root (selenium/build using the
46+
default directory on git clone). Noting that both Sphinx and tox cache parts of their build and
47+
recognize changes to speed up their respective builds. But at times one wants to start fresh
48+
deleting the aformentioned directory will clean the Sphinx cache or removing selenium/py/.tox
49+
directory for cleaning the tox environment.
50+
51+
52+
Known documentation issues
53+
==========================
54+
The API Reference primarily builds from the source code. But currently the initial template stating
55+
which modules to document is hard coded within py/docs/source/api.rst. So if modules are added or
56+
removed then the generated docs will be inaccurate. It would be preferred that the API docs generate
57+
soley from the code if possible. This is being tracked in `#14178 <https://github.com/SeleniumHQ/selenium/issues/14178>`_
58+
59+
We are working through the Sphinx build Warnings and Errors trying to clean up botht the syntax and
60+
the build.
61+
62+
Contributing to Python docs
63+
===========================
64+
First it is recommended that you read the main `CONTRIBUTING.md <https://github.com/SeleniumHQ/selenium/blob/trunk/CONTRIBUTING.md>`_.
65+
66+
Some steps for contibuting to the Python documentation ..
67+
68+
- Check out changes locally using instruction above.
69+
- Try to resolve any warnings/issues.
70+
- If too arduous either ask for help or add to list of known issue.
71+
- If this process is updated please update this doc as well to help the next person.

py/selenium/webdriver/chromium/webdriver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ def launch_app(self, id):
7777
def get_network_conditions(self):
7878
"""Gets Chromium network emulation settings.
7979
80-
:Returns: A dict. For example: {'latency': 4,
81-
'download_throughput': 2, 'upload_throughput': 2, 'offline':
82-
False}
80+
:Returns:
81+
A dict.
82+
For example: {'latency': 4, 'download_throughput': 2, 'upload_throughput': 2, 'offline': False}
8383
"""
8484
return self.execute("getNetworkConditions")["value"]
8585

py/selenium/webdriver/common/virtual_authenticator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ def __init__(
9191
9292
:Args:
9393
- credential_id (bytes): Unique base64 encoded string.
94-
is_resident_credential (bool): Whether the credential is client-side discoverable.
95-
rp_id (str): Relying party identifier.
96-
user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string. Can be None.
97-
private_key (bytes): Base64 encoded PKCS#8 private key.
98-
sign_count (int): intital value for a signature counter.
94+
- is_resident_credential (bool): Whether the credential is client-side discoverable.
95+
- rp_id (str): Relying party identifier.
96+
- user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string. Can be None.
97+
- private_key (bytes): Base64 encoded PKCS#8 private key.
98+
- sign_count (int): intital value for a signature counter.
9999
"""
100100
self._id = credential_id
101101
self._is_resident_credential = is_resident_credential

py/selenium/webdriver/support/relative_locator.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ def with_tag_name(tag_name: str) -> "RelativeBy":
3232
3333
Note: This method may be removed in future versions, please use
3434
`locate_with` instead.
35+
3536
:Args:
3637
- tag_name: the DOM tag of element to start searching.
3738
:Returns:
38-
- RelativeBy - use this object to create filters within a
39-
`find_elements` call.
39+
- RelativeBy: use this object to create filters within a
40+
`find_elements` call.
4041
"""
4142
if not tag_name:
4243
raise WebDriverException("tag_name can not be null")
@@ -50,8 +51,8 @@ def locate_with(by: ByType, using: str) -> "RelativeBy":
5051
- by: The value from `By` passed in.
5152
- using: search term to find the element with.
5253
:Returns:
53-
- RelativeBy - use this object to create filters within a
54-
`find_elements` call.
54+
- RelativeBy: use this object to create filters within a
55+
`find_elements` call.
5556
"""
5657
assert by is not None, "Please pass in a by argument"
5758
assert using is not None, "Please pass in a using argument"

0 commit comments

Comments
 (0)