-
-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support for Appium Chrome Dev Protocol Commands #1375
feat: Support for Appium Chrome Dev Protocol Commands #1375
Conversation
default Map<String,Object> executeCdpCommand(String command, @Nullable Map<String, Object> params) { | ||
Map<String, Object> data = new HashMap<>(); | ||
data.put("cmd",checkNotNull(command)); | ||
if(params != null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please auto format all files, so spaces are set properly everywhere
data.put("params",params); | ||
} | ||
Response response = execute(EXECUTE_CDP_COMMAND, data); | ||
Map<String, Object> value = (Map<String, Object>) response.getValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need in the intermediate value
variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid warning of Unchecked cast, Im continuing with the same representation but will be changing to return as Immutable map
data.put("params",params); | ||
}else{ | ||
params = new HashMap<>(); | ||
data.put("params",params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data.put("params", params == null ? Collections.emptyMap() : params)
@@ -69,7 +69,7 @@ | |||
@SuppressWarnings("unchecked") | |||
public class AppiumDriver<T extends WebElement> | |||
extends DefaultGenericMobileDriver<T> implements ComparesImages, FindsByImage<T>, FindsByCustom<T>, | |||
ExecutesDriverScript, LogsEvents, HasSettings { | |||
ExecutesDriverScript, LogsEvents, HasSettings,ExecuteCDPCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature is currently only present in AndroidDriver
@@ -282,6 +284,7 @@ | |||
commandRepository.put(COMPARE_IMAGES, postC("/session/:sessionId/appium/compare_images")); | |||
commandRepository.put(EXECUTE_DRIVER_SCRIPT, postC("/session/:sessionId/appium/execute_driver")); | |||
commandRepository.put(GET_ALLSESSION, getC("/sessions")); | |||
commandRepository.put(EXECUTE_CDP_COMMAND, postC("/session/:sessionId/goog/cdp/execute")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the vendor name is configurable. Please rename the constant to EXECUTE_GOOGLE_CDP_COMMAND
@mykola-mokhnach Will update the review comments and commit it again |
Change list
Client integration for Appium Chrome browser CDP Command support. Enable user to use chrome dev tool protocol commands in appium java client
new Endpoint : /session/:sessionId/goog/cdp/execute
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
x
in the boxes that applyDetails
Code Sample
Example 1 : Without Parameters
driver.executeCdpCommand("Page.getCookies")
Example 2 : With Parameters
Map<String,Object> params = new HashMap();
params.put("latitude", 13.0827);
params.put("longitude",80.2707);
params.put("accuracy",1);
driver.executeCdpCommand("Emulation.setGeolocationOverride",params);