feat: Support for Appium Chrome Dev Protocol Commands#1375
feat: Support for Appium Chrome Dev Protocol Commands#1375SrinivasanTarget merged 5 commits intoappium:masterappium/java-client:masterfrom jayandran-Sampath:chromeDevToolsSupportjayandran-Sampath/java-client:chromeDevToolsSupportCopy head branch name to clipboard
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.
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.
there is no need in the intermediate value variable
There was a problem hiding this comment.
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.
data.put("params", params == null ? Collections.emptyMap() : params)
| 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.
This feature is currently only present in AndroidDriver
| 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.
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
xin 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);