1
0
mirror of synced 2026-09-11 00:49:39 +00:00

fix: generate frameByUrl from api.json (#285)

This commit is contained in:
Yury Semikhatsky
2021-02-12 16:23:04 -08:00
committed by GitHub
parent 6fb0b01a17
commit b8a774eecc
7 changed files with 31 additions and 19 deletions
@@ -464,12 +464,6 @@ class Method extends Element {
private static Map<String, String[]> customSignature = new HashMap<>();
static {
customSignature.put("Page.setViewportSize", new String[]{"void setViewportSize(int width, int height);"});
customSignature.put("Page.frame", new String[]{
"Frame frameByName(String name);",
"Frame frameByUrl(String glob);",
"Frame frameByUrl(Pattern pattern);",
"Frame frameByUrl(Predicate<String> predicate);",
});
customSignature.put("BrowserContext.cookies", new String[]{
"default List<Cookie> cookies() { return cookies((List<String>) null); }",
"default List<Cookie> cookies(String url) { return cookies(Arrays.asList(url)); }",
@@ -568,6 +562,11 @@ class Method extends Element {
returnType = new TypeRef(this, jsonElement.get("type"));
if (jsonElement.has("args")) {
for (JsonElement arg : jsonElement.getAsJsonArray("args")) {
JsonObject paramObj = arg.getAsJsonObject();
if (paramObj.get("name").getAsString().equals("options") &&
paramObj.getAsJsonObject("type").getAsJsonArray("properties").size() == 0) {
continue;
}
params.add(new Param(this, arg.getAsJsonObject()));
}
}
@@ -52,8 +52,6 @@ class Types {
add("Page.exposeFunction.callback", "function", "FunctionCallback");
// The method has custom signatures
add("Page.frame.frameSelector", "Object|string", "Custom", new Empty());
add("Page.frame.options", "Object", "FrameOptions", new Empty());
add("Page.selectOption.values", "Array<ElementHandle>|Array<Object>|Array<string>|ElementHandle|Object|null|string", "String");
add("Page.setInputFiles.files", "Array<Object>|Array<path>|Object|path", "String");
add("Frame.selectOption.values", "Array<ElementHandle>|Array<Object>|Array<string>|ElementHandle|Object|null|string", "String");