-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[java] Add Missing W3C Exceptions (#12175)
* Add DetachedShadowRootException class and W3CError * Add no such shadow root to w3c error * add shadow root test and appServer page * Add insecure cert exception and w3c error --------- Co-authored-by: Diego Molina <[email protected]>
- Loading branch information
1 parent
3880298
commit da3a82b
Showing
6 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
java/src/org/openqa/selenium/DetachedShadowRootException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.selenium; | ||
|
||
/** | ||
* Indicates that a reference to a shadow root is now "detached" --- the element no longer appears on the | ||
* DOM of the page. | ||
*/ | ||
public class DetachedShadowRootException extends WebDriverException { | ||
public DetachedShadowRootException(String message) { | ||
super(message); | ||
} | ||
|
||
public DetachedShadowRootException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
java/src/org/openqa/selenium/InsecureCertificateException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.selenium; | ||
|
||
/** | ||
* Indicates that navigation caused by the user agent hit a certificate warning, which is usually the result of an expired or invalid TLS certificate. | ||
*/ | ||
public class InsecureCertificateException extends WebDriverException { | ||
public InsecureCertificateException(String message) { | ||
super(message); | ||
} | ||
|
||
public InsecureCertificateException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public InsecureCertificateException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.selenium; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; | ||
import org.junit.jupiter.api.Test; | ||
import org.openqa.selenium.testing.JupiterTestBase; | ||
|
||
public class NoSuchShadowRootTest extends JupiterTestBase{ | ||
|
||
@Test | ||
public void getNoSuchShadowRoot(){ | ||
driver.get(pages.shadowRootPage); | ||
WebElement nonExistentShadowRootElement = driver.findElement(By.id("noShadowRoot")); | ||
assertThatExceptionOfType(NoSuchShadowRootException.class).isThrownBy(() -> nonExistentShadowRootElement.getShadowRoot()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters