Skip to content

Commit

Permalink
Expose presence of devtools support on a role-based interface
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Jul 9, 2019
1 parent 796bb2d commit 2eeed81
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.devtools.Connection;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.HasDevTools;
import org.openqa.selenium.html5.LocalStorage;
import org.openqa.selenium.html5.Location;
import org.openqa.selenium.html5.LocationContext;
Expand Down Expand Up @@ -61,7 +62,7 @@
* to the appropriate interface.
*/
public class ChromiumDriver extends RemoteWebDriver
implements LocationContext, WebStorage, HasTouchScreen, NetworkConnection {
implements HasDevTools, HasTouchScreen, LocationContext, NetworkConnection, WebStorage {

private final RemoteLocationContext locationContext;
private final RemoteWebStorage webStorage;
Expand Down Expand Up @@ -152,6 +153,7 @@ public Map<String, Object> executeCdpCommand(String commandName, Map<String, Obj
return ImmutableMap.copyOf(toReturn);
}

@Override
public DevTools getDevTools() {
return connection.map(DevTools::new)
.orElseThrow(() -> new WebDriverException("Unable to create DevTools connection"));
Expand Down
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/devtools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ java_library(
"//java/client/src/org/openqa/selenium/chromium:__pkg__",
"//java/client/src/org/openqa/selenium/edge:__pkg__",
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//java/client/test/org/openqa/selenium/devtools:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium:core",
Expand Down
24 changes: 24 additions & 0 deletions java/client/src/org/openqa/selenium/devtools/HasDevTools.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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.devtools;

public interface HasDevTools {

DevTools getDevTools();

}

0 comments on commit 2eeed81

Please sign in to comment.