Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: split nodejs and python links (#4942)

Pavel Feldman15c0a2952686
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md
index 29da8d1dd1..8f4418464c 100644
--- a/docs/src/api/class-browsercontext.md
+++ b/docs/src/api/class-browsercontext.md
@@ -399,6 +399,7 @@ await browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});
pages to read its geolocation.
### param: BrowserContext.setGeolocation.geolocation
+* langs: js
- `geolocation` <[null]|[Object]>
- `latitude` <[float]> Latitude between -90 and 90. **required**
- `longitude` <[float]> Longitude between -180 and 180. **required**
diff --git a/docs/src/api/python.md b/docs/src/api/python.md
index 01cff4439f..e96245c8cb 100644
--- a/docs/src/api/python.md
+++ b/docs/src/api/python.md
@@ -56,3 +56,26 @@ Script to be evaluated in all pages in the browser context. Optional.
### param: Page.selectOption.index = %%-python-select-options-index-%%
### param: Page.selectOption.value = %%-python-select-options-value-%%
### param: Page.selectOption.label = %%-python-select-options-label-%%
+
+## async method: BrowserContext.resetGeolocation
+* langs: python
+
+Emulates position unavailable state.
+
+### param: BrowserContext.setGeolocation.latitude
+* langs: python
+- `latitude` <[float]>
+
+Latitude between -90 and 90. **required**
+
+### param: BrowserContext.setGeolocation.longitude
+* langs: python
+- `longitude` <[float]>
+
+Longitude between -180 and 180. **required**
+
+### param: BrowserContext.setGeolocation.accuracy
+* langs: python
+- `accuracy` <[float]>
+
+Non-negative accuracy value. Defaults to `0`. Optional.
diff --git a/docs/src/links-js.md b/docs/src/links-js.md
new file mode 100644
index 0000000000..f195d61e24
--- /dev/null
+++ b/docs/src/links-js.md
@@ -0,0 +1,15 @@
+[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
+[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
+[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
+[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
+[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
+[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
+[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
+[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
+[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
+[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
+[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
+[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
+[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
+[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
+[URL]: https://nodejs.org/api/url.html "URL"
\ No newline at end of file
diff --git a/docs/src/links-python.md b/docs/src/links-python.md
new file mode 100644
index 0000000000..09aab35ce8
--- /dev/null
+++ b/docs/src/links-python.md
@@ -0,0 +1,11 @@
+[Any]: https://docs.python.org/3/library/typing.html#typing.Any "Any"
+[bool]: https://docs.python.org/3/library/stdtypes.html "bool"
+[Callable]: https://docs.python.org/3/library/typing.html#typing.Callable "Callable"
+[Dict]: https://docs.python.org/3/library/typing.html#typing.Dict "Dict"
+[float]: https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex "float"
+[int]: https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex "int"
+[List]: https://docs.python.org/3/library/typing.html#typing.List "List"
+[NoneType]: https://docs.python.org/3/library/constants.html#None "None"
+[pathlib.Path]: https://realpython.com/python-pathlib/ "pathlib.Path"
+[str]: https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str "str"
+[Union]: https://docs.python.org/3/library/typing.html#typing.Union "Union"
\ No newline at end of file
diff --git a/docs/src/links.md b/docs/src/links.md
index 74f2e36253..12071544b9 100644
--- a/docs/src/links.md
+++ b/docs/src/links.md
@@ -1,25 +1,9 @@
-[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
-[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
-[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"
-[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
[Evaluation Argument]: ./core-concepts.md#evaluationargument "Evaluation Argument"
-[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
-[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
-[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
-[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
-[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
-[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
-[URL]: https://nodejs.org/api/url.html "URL"
-[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"
-[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
-[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
-[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"
-[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
-[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"
[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"
-[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
-[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
+[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
+[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
+[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"
diff --git a/utils/doclint/api_parser.js b/utils/doclint/api_parser.js
index 184479d371..b8cffad024 100644
--- a/utils/doclint/api_parser.js
+++ b/utils/doclint/api_parser.js
@@ -86,19 +86,16 @@ class ApiParser {
if (!returnType)
returnType = new Documentation.Type('void');
- if (match[1] === 'async method') {
- const templates = [ returnType ];
- returnType = new Documentation.Type('Promise');
- returnType.templates = templates;
- }
-
let member;
if (match[1] === 'event')
member = Documentation.Member.createEvent(extractLangs(spec), name, returnType, extractComments(spec));
if (match[1] === 'property')
member = Documentation.Member.createProperty(extractLangs(spec), name, returnType, extractComments(spec));
- if (match[1] === 'method' || match[1] === 'async method')
+ if (match[1] === 'method' || match[1] === 'async method') {
member = Documentation.Member.createMethod(extractLangs(spec), name, [], returnType, extractComments(spec));
+ if (match[1] === 'async method')
+ member.async = true;
+ }
const clazz = this.classes.get(match[2]);
clazz.membersArray.push(member);
}
diff --git a/utils/doclint/documentation.js b/utils/doclint/documentation.js
index 459e69e978..897c5eb040 100644
--- a/utils/doclint/documentation.js
+++ b/utils/doclint/documentation.js
@@ -285,7 +285,8 @@ Documentation.Member = class {
if (node.text && node.text.includes('**DEPRECATED**'))
this.deprecated = true;
});
- }
+ };
+ this.async = false;
}
index() {
@@ -312,7 +313,9 @@ Documentation.Member = class {
}
clone() {
- return new Documentation.Member(this.kind, this.langs, this.name, this.type, this.argsArray, this.spec, this.required);
+ const result = new Documentation.Member(this.kind, this.langs, this.name, this.type, this.argsArray, this.spec, this.required);
+ result.async = this.async;
+ return result;
}
/**
diff --git a/utils/generate_types/index.js b/utils/generate_types/index.js
index 52046b386c..47eb2f4a43 100644
--- a/utils/generate_types/index.js
+++ b/utils/generate_types/index.js
@@ -229,7 +229,9 @@ function classBody(classDesc) {
}
const jsdoc = memberJSDOC(member, ' ');
const args = argsFromMember(member, ' ', classDesc.name);
- const type = stringifyComplexType(member.type, ' ', classDesc.name, member.name);
+ let type = stringifyComplexType(member.type, ' ', classDesc.name, member.name);
+ if (member.async)
+ type = `Promise<${type}>`;
// do this late, because we still want object definitions for overridden types
if (!hasOwnMethod(classDesc, member.name))
return '';