solvecdp 0.0.4__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {solvecdp-0.0.4/solvecdp.egg-info → solvecdp-0.0.6}/PKG-INFO +12 -35
- {solvecdp-0.0.4 → solvecdp-0.0.6}/README.md +10 -34
- {solvecdp-0.0.4 → solvecdp-0.0.6}/pyproject.toml +6 -0
- solvecdp-0.0.6/solvecdp/__init__.py +4 -0
- solvecdp-0.0.6/solvecdp/_modidx.py +10 -0
- solvecdp-0.0.6/solvecdp/core.py +31 -0
- {solvecdp-0.0.4 → solvecdp-0.0.6/solvecdp.egg-info}/PKG-INFO +12 -35
- {solvecdp-0.0.4 → solvecdp-0.0.6}/solvecdp.egg-info/SOURCES.txt +0 -2
- {solvecdp-0.0.4 → solvecdp-0.0.6}/solvecdp.egg-info/requires.txt +1 -0
- solvecdp-0.0.4/solvecdp/__init__.py +0 -2
- solvecdp-0.0.4/solvecdp/_modidx.py +0 -62
- solvecdp-0.0.4/solvecdp/browser_protocol.json +0 -31501
- solvecdp-0.0.4/solvecdp/core.py +0 -302
- solvecdp-0.0.4/solvecdp/js_protocol.json +0 -3810
- {solvecdp-0.0.4 → solvecdp-0.0.6}/LICENSE +0 -0
- {solvecdp-0.0.4 → solvecdp-0.0.6}/MANIFEST.in +0 -0
- {solvecdp-0.0.4 → solvecdp-0.0.6}/setup.cfg +0 -0
- {solvecdp-0.0.4 → solvecdp-0.0.6}/solvecdp.egg-info/dependency_links.txt +0 -0
- {solvecdp-0.0.4 → solvecdp-0.0.6}/solvecdp.egg-info/entry_points.txt +0 -0
- {solvecdp-0.0.4 → solvecdp-0.0.6}/solvecdp.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: solvecdp
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Lightweight Chrome Debug Protocol (CDP) client for solveit
|
|
5
5
|
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -13,6 +13,7 @@ Requires-Python: >=3.10
|
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: dialoghelper
|
|
16
|
+
Requires-Dist: fastcdp>=0.0.7
|
|
16
17
|
Requires-Dist: fastcore
|
|
17
18
|
Dynamic: license-file
|
|
18
19
|
|
|
@@ -21,29 +22,15 @@ Dynamic: license-file
|
|
|
21
22
|
|
|
22
23
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
23
24
|
|
|
24
|
-
fastcdp provides an async Python client for the [Chrome DevTools
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
attribute with auto-generated signatures and docstrings —
|
|
28
|
-
e.g. `await cdp.page.navigate(url=...)`.
|
|
29
|
-
|
|
30
|
-
It includes event subscription via `cdp.on()`/`cdp.wait_event()`,
|
|
31
|
-
navigation helpers (`goto`, `wait_for_selector`, `wait_for`), screenshot
|
|
32
|
-
capture, and accessibility tree access. A
|
|
33
|
-
[`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search)
|
|
34
|
-
utility lets you search CDP commands by name or description. For use
|
|
35
|
-
inside [safepyrun](https://github.com/AnswerDotAI/safepyrun) sandboxes,
|
|
36
|
-
[`cdp_yolo()`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_yolo)
|
|
37
|
-
registers all CDP classes.
|
|
25
|
+
fastcdp provides an async Python client for the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP) over solveit’s js bridge. It exposes every CDP domain as a Python attribute with auto-generated signatures and docstrings — e.g. `await cdp.page.navigate(url=...)`.
|
|
26
|
+
|
|
27
|
+
It includes event subscription via `cdp.on()`/`cdp.wait_event()`, navigation helpers (`goto`, `wait_for_selector`, `wait_for`), screenshot capture, and accessibility tree access. A [`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search) utility lets you search CDP commands by name or description. For use inside [safepyrun](https://github.com/AnswerDotAI/safepyrun) sandboxes, [`cdp_yolo()`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_yolo) registers all CDP classes.
|
|
38
28
|
|
|
39
29
|
## Installation
|
|
40
30
|
|
|
41
|
-
You must install the [solveit-chrome
|
|
42
|
-
extension](https://github.com/AnswerDotAI/solveit-chrome) before using
|
|
43
|
-
solvecdp.
|
|
31
|
+
You must install the [solveit-chrome extension](https://github.com/AnswerDotAI/solveit-chrome) before using solvecdp.
|
|
44
32
|
|
|
45
|
-
Solveit already has solvecdp installed, but if you want to install the
|
|
46
|
-
latest you can get it from [pypi](https://pypi.org/project/solvecdp/):
|
|
33
|
+
Solveit already has solvecdp installed, but if you want to install the latest you can get it from [pypi](https://pypi.org/project/solvecdp/):
|
|
47
34
|
|
|
48
35
|
``` sh
|
|
49
36
|
$ pip install solvecdp
|
|
@@ -57,9 +44,7 @@ from solvecdp import *
|
|
|
57
44
|
|
|
58
45
|
### The JsCDP class
|
|
59
46
|
|
|
60
|
-
Every CDP domain is available as an attribute with auto-generated
|
|
61
|
-
signatures. You can search for commands with
|
|
62
|
-
[`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search):
|
|
47
|
+
Every CDP domain is available as an attribute with auto-generated signatures. You can search for commands with [`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search):
|
|
63
48
|
|
|
64
49
|
``` python
|
|
65
50
|
cdp_search('screenshot')
|
|
@@ -87,8 +72,7 @@ await jc.eval('document.title')
|
|
|
87
72
|
|
|
88
73
|
'6. httpbin.org/forms/post'
|
|
89
74
|
|
|
90
|
-
Or you can `wait_for` any js expression to be truthy, and have it
|
|
91
|
-
returned:
|
|
75
|
+
Or you can `wait_for` any js expression to be truthy, and have it returned:
|
|
92
76
|
|
|
93
77
|
``` python
|
|
94
78
|
await jc.wait_for('document.title')
|
|
@@ -108,8 +92,7 @@ Clean up when done:
|
|
|
108
92
|
await jc.close()
|
|
109
93
|
```
|
|
110
94
|
|
|
111
|
-
See [`JsCDP`](https://AnswerDotAI.github.io/solvecdp/core.html#jscdp)
|
|
112
|
-
docs for full details.
|
|
95
|
+
See [`JsCDP`](https://AnswerDotAI.github.io/solvecdp/core.html#jscdp) docs for full details.
|
|
113
96
|
|
|
114
97
|
## Filling forms
|
|
115
98
|
|
|
@@ -147,8 +130,7 @@ await page.click(root.find_id('radio', 'Large'))
|
|
|
147
130
|
await page.js_node_run('this.value = "18:30"', root.find_id('InputTime', 'delivery time'));
|
|
148
131
|
```
|
|
149
132
|
|
|
150
|
-
You can use `click` to click a button, or `click_and_wait` to wait for
|
|
151
|
-
the next page to load:
|
|
133
|
+
You can use `click` to click a button, or `click_and_wait` to wait for the next page to load:
|
|
152
134
|
|
|
153
135
|
``` python
|
|
154
136
|
await page.click_and_wait(root.find_id('button', 'Submit order'))
|
|
@@ -166,9 +148,4 @@ cdp_yolo()
|
|
|
166
148
|
|
|
167
149
|
Then use a prompt such as:
|
|
168
150
|
|
|
169
|
-
> Try using
|
|
170
|
-
> fill it out, read it to check it’s filled correctly, then submit it,
|
|
171
|
-
> and see what you get back. Don’t use find_id - you can get all the ids
|
|
172
|
-
> at once with ax_tree (don’t truncate the result of it). Don’t add
|
|
173
|
-
> extra waits etc - solvecdp handles it automatically. IDs can change so
|
|
174
|
-
> be sure to use the ax_tree IDs you read.
|
|
151
|
+
> Try using python to create a `page_` JsCDP object, then goto `<url>`, fill it out, read it to check it’s filled correctly, then submit it, and see what you get back. Don’t use find_id - you can get all the ids at once with ax_tree (don’t truncate the result of it). Don’t add extra waits etc - solvecdp handles it automatically. IDs can change so be sure to use the ax_tree IDs you read.
|
|
@@ -3,29 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
5
5
|
|
|
6
|
-
fastcdp provides an async Python client for the [Chrome DevTools
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
attribute with auto-generated signatures and docstrings —
|
|
10
|
-
e.g. `await cdp.page.navigate(url=...)`.
|
|
11
|
-
|
|
12
|
-
It includes event subscription via `cdp.on()`/`cdp.wait_event()`,
|
|
13
|
-
navigation helpers (`goto`, `wait_for_selector`, `wait_for`), screenshot
|
|
14
|
-
capture, and accessibility tree access. A
|
|
15
|
-
[`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search)
|
|
16
|
-
utility lets you search CDP commands by name or description. For use
|
|
17
|
-
inside [safepyrun](https://github.com/AnswerDotAI/safepyrun) sandboxes,
|
|
18
|
-
[`cdp_yolo()`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_yolo)
|
|
19
|
-
registers all CDP classes.
|
|
6
|
+
fastcdp provides an async Python client for the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP) over solveit’s js bridge. It exposes every CDP domain as a Python attribute with auto-generated signatures and docstrings — e.g. `await cdp.page.navigate(url=...)`.
|
|
7
|
+
|
|
8
|
+
It includes event subscription via `cdp.on()`/`cdp.wait_event()`, navigation helpers (`goto`, `wait_for_selector`, `wait_for`), screenshot capture, and accessibility tree access. A [`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search) utility lets you search CDP commands by name or description. For use inside [safepyrun](https://github.com/AnswerDotAI/safepyrun) sandboxes, [`cdp_yolo()`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_yolo) registers all CDP classes.
|
|
20
9
|
|
|
21
10
|
## Installation
|
|
22
11
|
|
|
23
|
-
You must install the [solveit-chrome
|
|
24
|
-
extension](https://github.com/AnswerDotAI/solveit-chrome) before using
|
|
25
|
-
solvecdp.
|
|
12
|
+
You must install the [solveit-chrome extension](https://github.com/AnswerDotAI/solveit-chrome) before using solvecdp.
|
|
26
13
|
|
|
27
|
-
Solveit already has solvecdp installed, but if you want to install the
|
|
28
|
-
latest you can get it from [pypi](https://pypi.org/project/solvecdp/):
|
|
14
|
+
Solveit already has solvecdp installed, but if you want to install the latest you can get it from [pypi](https://pypi.org/project/solvecdp/):
|
|
29
15
|
|
|
30
16
|
``` sh
|
|
31
17
|
$ pip install solvecdp
|
|
@@ -39,9 +25,7 @@ from solvecdp import *
|
|
|
39
25
|
|
|
40
26
|
### The JsCDP class
|
|
41
27
|
|
|
42
|
-
Every CDP domain is available as an attribute with auto-generated
|
|
43
|
-
signatures. You can search for commands with
|
|
44
|
-
[`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search):
|
|
28
|
+
Every CDP domain is available as an attribute with auto-generated signatures. You can search for commands with [`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search):
|
|
45
29
|
|
|
46
30
|
``` python
|
|
47
31
|
cdp_search('screenshot')
|
|
@@ -69,8 +53,7 @@ await jc.eval('document.title')
|
|
|
69
53
|
|
|
70
54
|
'6. httpbin.org/forms/post'
|
|
71
55
|
|
|
72
|
-
Or you can `wait_for` any js expression to be truthy, and have it
|
|
73
|
-
returned:
|
|
56
|
+
Or you can `wait_for` any js expression to be truthy, and have it returned:
|
|
74
57
|
|
|
75
58
|
``` python
|
|
76
59
|
await jc.wait_for('document.title')
|
|
@@ -90,8 +73,7 @@ Clean up when done:
|
|
|
90
73
|
await jc.close()
|
|
91
74
|
```
|
|
92
75
|
|
|
93
|
-
See [`JsCDP`](https://AnswerDotAI.github.io/solvecdp/core.html#jscdp)
|
|
94
|
-
docs for full details.
|
|
76
|
+
See [`JsCDP`](https://AnswerDotAI.github.io/solvecdp/core.html#jscdp) docs for full details.
|
|
95
77
|
|
|
96
78
|
## Filling forms
|
|
97
79
|
|
|
@@ -129,8 +111,7 @@ await page.click(root.find_id('radio', 'Large'))
|
|
|
129
111
|
await page.js_node_run('this.value = "18:30"', root.find_id('InputTime', 'delivery time'));
|
|
130
112
|
```
|
|
131
113
|
|
|
132
|
-
You can use `click` to click a button, or `click_and_wait` to wait for
|
|
133
|
-
the next page to load:
|
|
114
|
+
You can use `click` to click a button, or `click_and_wait` to wait for the next page to load:
|
|
134
115
|
|
|
135
116
|
``` python
|
|
136
117
|
await page.click_and_wait(root.find_id('button', 'Submit order'))
|
|
@@ -148,9 +129,4 @@ cdp_yolo()
|
|
|
148
129
|
|
|
149
130
|
Then use a prompt such as:
|
|
150
131
|
|
|
151
|
-
> Try using
|
|
152
|
-
> fill it out, read it to check it’s filled correctly, then submit it,
|
|
153
|
-
> and see what you get back. Don’t use find_id - you can get all the ids
|
|
154
|
-
> at once with ax_tree (don’t truncate the result of it). Don’t add
|
|
155
|
-
> extra waits etc - solvecdp handles it automatically. IDs can change so
|
|
156
|
-
> be sure to use the ax_tree IDs you read.
|
|
132
|
+
> Try using python to create a `page_` JsCDP object, then goto `<url>`, fill it out, read it to check it’s filled correctly, then submit it, and see what you get back. Don’t use find_id - you can get all the ids at once with ax_tree (don’t truncate the result of it). Don’t add extra waits etc - solvecdp handles it automatically. IDs can change so be sure to use the ax_tree IDs you read.
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
]
|
|
18
18
|
dependencies = [
|
|
19
19
|
"dialoghelper",
|
|
20
|
+
"fastcdp>=0.0.7",
|
|
20
21
|
"fastcore"
|
|
21
22
|
]
|
|
22
23
|
|
|
@@ -37,3 +38,8 @@ include = ["solvecdp"]
|
|
|
37
38
|
solvecdp = ["*.json"]
|
|
38
39
|
|
|
39
40
|
[tool.nbdev]
|
|
41
|
+
allowed_metadata_keys = ['solveit']
|
|
42
|
+
allowed_cell_metadata_keys = ['solveit_ai']
|
|
43
|
+
|
|
44
|
+
[tool.chkstyle]
|
|
45
|
+
skip_paths = ["_modidx.py"]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Autogenerated by nbdev
|
|
2
|
+
|
|
3
|
+
d = { 'settings': { 'branch': 'main',
|
|
4
|
+
'doc_baseurl': '/solvecdp',
|
|
5
|
+
'doc_host': 'https://AnswerDotAI.github.io',
|
|
6
|
+
'git_url': 'https://github.com/AnswerDotAI/solvecdp',
|
|
7
|
+
'lib_path': 'solvecdp'},
|
|
8
|
+
'syms': { 'solvecdp.core': { 'solvecdp.core.JsCDP': ('core.html#jscdp', 'solvecdp/core.py'),
|
|
9
|
+
'solvecdp.core.JsCDP.connect': ('core.html#jscdp.connect', 'solvecdp/core.py'),
|
|
10
|
+
'solvecdp.core.cdp_yolo': ('core.html#cdp_yolo', 'solvecdp/core.py')}}}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Drive the user's Chrome from a solveit kernel
|
|
2
|
+
|
|
3
|
+
Docs: https://AnswerDotAI.github.io/solvecdp/core.html.md"""
|
|
4
|
+
|
|
5
|
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
|
|
6
|
+
|
|
7
|
+
# %% auto #0
|
|
8
|
+
__all__ = ['JsCDP', 'cdp_yolo']
|
|
9
|
+
|
|
10
|
+
# %% ../nbs/00_core.ipynb #34dc06ce
|
|
11
|
+
from fastcore.utils import *
|
|
12
|
+
from dialoghelper import *
|
|
13
|
+
from fastcdp.ext import *
|
|
14
|
+
import fastcdp.ext
|
|
15
|
+
|
|
16
|
+
# %% ../nbs/00_core.ipynb #633a6930
|
|
17
|
+
class JsCDP(ExtCDP):
|
|
18
|
+
"CDP over the solveit-chrome extension: frames relayed via solveit's `/wsx` channel"
|
|
19
|
+
@classmethod
|
|
20
|
+
async def connect(cls,
|
|
21
|
+
chan='cdp', # Relay channel name the extension serves
|
|
22
|
+
debug=None # Print events as they arrive?
|
|
23
|
+
):
|
|
24
|
+
return await super().connect(await Channel.connect(chan), debug=debug)
|
|
25
|
+
|
|
26
|
+
# %% ../nbs/00_core.ipynb #8fbd7193
|
|
27
|
+
def cdp_yolo():
|
|
28
|
+
"Allow all CDP classes in safepyrun"
|
|
29
|
+
from pyskills import allow
|
|
30
|
+
fastcdp.ext.cdp_yolo()
|
|
31
|
+
allow({JsCDP:...})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: solvecdp
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Lightweight Chrome Debug Protocol (CDP) client for solveit
|
|
5
5
|
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -13,6 +13,7 @@ Requires-Python: >=3.10
|
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: dialoghelper
|
|
16
|
+
Requires-Dist: fastcdp>=0.0.7
|
|
16
17
|
Requires-Dist: fastcore
|
|
17
18
|
Dynamic: license-file
|
|
18
19
|
|
|
@@ -21,29 +22,15 @@ Dynamic: license-file
|
|
|
21
22
|
|
|
22
23
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
23
24
|
|
|
24
|
-
fastcdp provides an async Python client for the [Chrome DevTools
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
attribute with auto-generated signatures and docstrings —
|
|
28
|
-
e.g. `await cdp.page.navigate(url=...)`.
|
|
29
|
-
|
|
30
|
-
It includes event subscription via `cdp.on()`/`cdp.wait_event()`,
|
|
31
|
-
navigation helpers (`goto`, `wait_for_selector`, `wait_for`), screenshot
|
|
32
|
-
capture, and accessibility tree access. A
|
|
33
|
-
[`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search)
|
|
34
|
-
utility lets you search CDP commands by name or description. For use
|
|
35
|
-
inside [safepyrun](https://github.com/AnswerDotAI/safepyrun) sandboxes,
|
|
36
|
-
[`cdp_yolo()`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_yolo)
|
|
37
|
-
registers all CDP classes.
|
|
25
|
+
fastcdp provides an async Python client for the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP) over solveit’s js bridge. It exposes every CDP domain as a Python attribute with auto-generated signatures and docstrings — e.g. `await cdp.page.navigate(url=...)`.
|
|
26
|
+
|
|
27
|
+
It includes event subscription via `cdp.on()`/`cdp.wait_event()`, navigation helpers (`goto`, `wait_for_selector`, `wait_for`), screenshot capture, and accessibility tree access. A [`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search) utility lets you search CDP commands by name or description. For use inside [safepyrun](https://github.com/AnswerDotAI/safepyrun) sandboxes, [`cdp_yolo()`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_yolo) registers all CDP classes.
|
|
38
28
|
|
|
39
29
|
## Installation
|
|
40
30
|
|
|
41
|
-
You must install the [solveit-chrome
|
|
42
|
-
extension](https://github.com/AnswerDotAI/solveit-chrome) before using
|
|
43
|
-
solvecdp.
|
|
31
|
+
You must install the [solveit-chrome extension](https://github.com/AnswerDotAI/solveit-chrome) before using solvecdp.
|
|
44
32
|
|
|
45
|
-
Solveit already has solvecdp installed, but if you want to install the
|
|
46
|
-
latest you can get it from [pypi](https://pypi.org/project/solvecdp/):
|
|
33
|
+
Solveit already has solvecdp installed, but if you want to install the latest you can get it from [pypi](https://pypi.org/project/solvecdp/):
|
|
47
34
|
|
|
48
35
|
``` sh
|
|
49
36
|
$ pip install solvecdp
|
|
@@ -57,9 +44,7 @@ from solvecdp import *
|
|
|
57
44
|
|
|
58
45
|
### The JsCDP class
|
|
59
46
|
|
|
60
|
-
Every CDP domain is available as an attribute with auto-generated
|
|
61
|
-
signatures. You can search for commands with
|
|
62
|
-
[`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search):
|
|
47
|
+
Every CDP domain is available as an attribute with auto-generated signatures. You can search for commands with [`cdp_search`](https://AnswerDotAI.github.io/solvecdp/core.html#cdp_search):
|
|
63
48
|
|
|
64
49
|
``` python
|
|
65
50
|
cdp_search('screenshot')
|
|
@@ -87,8 +72,7 @@ await jc.eval('document.title')
|
|
|
87
72
|
|
|
88
73
|
'6. httpbin.org/forms/post'
|
|
89
74
|
|
|
90
|
-
Or you can `wait_for` any js expression to be truthy, and have it
|
|
91
|
-
returned:
|
|
75
|
+
Or you can `wait_for` any js expression to be truthy, and have it returned:
|
|
92
76
|
|
|
93
77
|
``` python
|
|
94
78
|
await jc.wait_for('document.title')
|
|
@@ -108,8 +92,7 @@ Clean up when done:
|
|
|
108
92
|
await jc.close()
|
|
109
93
|
```
|
|
110
94
|
|
|
111
|
-
See [`JsCDP`](https://AnswerDotAI.github.io/solvecdp/core.html#jscdp)
|
|
112
|
-
docs for full details.
|
|
95
|
+
See [`JsCDP`](https://AnswerDotAI.github.io/solvecdp/core.html#jscdp) docs for full details.
|
|
113
96
|
|
|
114
97
|
## Filling forms
|
|
115
98
|
|
|
@@ -147,8 +130,7 @@ await page.click(root.find_id('radio', 'Large'))
|
|
|
147
130
|
await page.js_node_run('this.value = "18:30"', root.find_id('InputTime', 'delivery time'));
|
|
148
131
|
```
|
|
149
132
|
|
|
150
|
-
You can use `click` to click a button, or `click_and_wait` to wait for
|
|
151
|
-
the next page to load:
|
|
133
|
+
You can use `click` to click a button, or `click_and_wait` to wait for the next page to load:
|
|
152
134
|
|
|
153
135
|
``` python
|
|
154
136
|
await page.click_and_wait(root.find_id('button', 'Submit order'))
|
|
@@ -166,9 +148,4 @@ cdp_yolo()
|
|
|
166
148
|
|
|
167
149
|
Then use a prompt such as:
|
|
168
150
|
|
|
169
|
-
> Try using
|
|
170
|
-
> fill it out, read it to check it’s filled correctly, then submit it,
|
|
171
|
-
> and see what you get back. Don’t use find_id - you can get all the ids
|
|
172
|
-
> at once with ax_tree (don’t truncate the result of it). Don’t add
|
|
173
|
-
> extra waits etc - solvecdp handles it automatically. IDs can change so
|
|
174
|
-
> be sure to use the ax_tree IDs you read.
|
|
151
|
+
> Try using python to create a `page_` JsCDP object, then goto `<url>`, fill it out, read it to check it’s filled correctly, then submit it, and see what you get back. Don’t use find_id - you can get all the ids at once with ax_tree (don’t truncate the result of it). Don’t add extra waits etc - solvecdp handles it automatically. IDs can change so be sure to use the ax_tree IDs you read.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Autogenerated by nbdev
|
|
2
|
-
|
|
3
|
-
d = { 'settings': { 'branch': 'main',
|
|
4
|
-
'doc_baseurl': '/solvecdp',
|
|
5
|
-
'doc_host': 'https://AnswerDotAI.github.io',
|
|
6
|
-
'git_url': 'https://github.com/AnswerDotAI/solvecdp',
|
|
7
|
-
'lib_path': 'solvecdp'},
|
|
8
|
-
'syms': { 'solvecdp.core': { 'solvecdp.core.AXNode': ('core.html#axnode', 'solvecdp/core.py'),
|
|
9
|
-
'solvecdp.core.AXNode.__init__': ('core.html#axnode.__init__', 'solvecdp/core.py'),
|
|
10
|
-
'solvecdp.core.AXNode._repr_markdown_': ('core.html#axnode._repr_markdown_', 'solvecdp/core.py'),
|
|
11
|
-
'solvecdp.core.AXNode.find': ('core.html#axnode.find', 'solvecdp/core.py'),
|
|
12
|
-
'solvecdp.core.AXNode.find_all': ('core.html#axnode.find_all', 'solvecdp/core.py'),
|
|
13
|
-
'solvecdp.core.AXNode.find_id': ('core.html#axnode.find_id', 'solvecdp/core.py'),
|
|
14
|
-
'solvecdp.core.AXTree': ('core.html#axtree', 'solvecdp/core.py'),
|
|
15
|
-
'solvecdp.core.AXTree._repr_markdown_': ('core.html#axtree._repr_markdown_', 'solvecdp/core.py'),
|
|
16
|
-
'solvecdp.core.JsCDP': ('core.html#jscdp', 'solvecdp/core.py'),
|
|
17
|
-
'solvecdp.core.JsCDP.__aenter__': ('core.html#jscdp.__aenter__', 'solvecdp/core.py'),
|
|
18
|
-
'solvecdp.core.JsCDP.__aexit__': ('core.html#jscdp.__aexit__', 'solvecdp/core.py'),
|
|
19
|
-
'solvecdp.core.JsCDP.__call__': ('core.html#jscdp.__call__', 'solvecdp/core.py'),
|
|
20
|
-
'solvecdp.core.JsCDP.__del__': ('core.html#jscdp.__del__', 'solvecdp/core.py'),
|
|
21
|
-
'solvecdp.core.JsCDP.__getattr__': ('core.html#jscdp.__getattr__', 'solvecdp/core.py'),
|
|
22
|
-
'solvecdp.core.JsCDP.__init__': ('core.html#jscdp.__init__', 'solvecdp/core.py'),
|
|
23
|
-
'solvecdp.core.JsCDP.ax_tree': ('core.html#jscdp.ax_tree', 'solvecdp/core.py'),
|
|
24
|
-
'solvecdp.core.JsCDP.click': ('core.html#jscdp.click', 'solvecdp/core.py'),
|
|
25
|
-
'solvecdp.core.JsCDP.click_and_wait': ('core.html#jscdp.click_and_wait', 'solvecdp/core.py'),
|
|
26
|
-
'solvecdp.core.JsCDP.close': ('core.html#jscdp.close', 'solvecdp/core.py'),
|
|
27
|
-
'solvecdp.core.JsCDP.detach': ('core.html#jscdp.detach', 'solvecdp/core.py'),
|
|
28
|
-
'solvecdp.core.JsCDP.eval': ('core.html#jscdp.eval', 'solvecdp/core.py'),
|
|
29
|
-
'solvecdp.core.JsCDP.fill_text': ('core.html#jscdp.fill_text', 'solvecdp/core.py'),
|
|
30
|
-
'solvecdp.core.JsCDP.goto': ('core.html#jscdp.goto', 'solvecdp/core.py'),
|
|
31
|
-
'solvecdp.core.JsCDP.js_node': ('core.html#jscdp.js_node', 'solvecdp/core.py'),
|
|
32
|
-
'solvecdp.core.JsCDP.js_node_run': ('core.html#jscdp.js_node_run', 'solvecdp/core.py'),
|
|
33
|
-
'solvecdp.core.JsCDP.new': ('core.html#jscdp.new', 'solvecdp/core.py'),
|
|
34
|
-
'solvecdp.core.JsCDP.on': ('core.html#jscdp.on', 'solvecdp/core.py'),
|
|
35
|
-
'solvecdp.core.JsCDP.pages': ('core.html#jscdp.pages', 'solvecdp/core.py'),
|
|
36
|
-
'solvecdp.core.JsCDP.screenshot': ('core.html#jscdp.screenshot', 'solvecdp/core.py'),
|
|
37
|
-
'solvecdp.core.JsCDP.unsubscribe': ('core.html#jscdp.unsubscribe', 'solvecdp/core.py'),
|
|
38
|
-
'solvecdp.core.JsCDP.wait_for': ('core.html#jscdp.wait_for', 'solvecdp/core.py'),
|
|
39
|
-
'solvecdp.core.JsCDP.wait_for_ready': ('core.html#jscdp.wait_for_ready', 'solvecdp/core.py'),
|
|
40
|
-
'solvecdp.core.JsCDP.wait_for_selector': ('core.html#jscdp.wait_for_selector', 'solvecdp/core.py'),
|
|
41
|
-
'solvecdp.core.JsCDPDomain': ('core.html#jscdpdomain', 'solvecdp/core.py'),
|
|
42
|
-
'solvecdp.core.JsCDPDomain.__dir__': ('core.html#jscdpdomain.__dir__', 'solvecdp/core.py'),
|
|
43
|
-
'solvecdp.core.JsCDPDomain.__getattr__': ('core.html#jscdpdomain.__getattr__', 'solvecdp/core.py'),
|
|
44
|
-
'solvecdp.core.JsCDPDomain.__init__': ('core.html#jscdpdomain.__init__', 'solvecdp/core.py'),
|
|
45
|
-
'solvecdp.core.JsCDPMethod': ('core.html#jscdpmethod', 'solvecdp/core.py'),
|
|
46
|
-
'solvecdp.core.JsCDPMethod.__call__': ('core.html#jscdpmethod.__call__', 'solvecdp/core.py'),
|
|
47
|
-
'solvecdp.core.JsCDPMethod.__init__': ('core.html#jscdpmethod.__init__', 'solvecdp/core.py'),
|
|
48
|
-
'solvecdp.core.JsSub': ('core.html#jssub', 'solvecdp/core.py'),
|
|
49
|
-
'solvecdp.core.JsSub.__aenter__': ('core.html#jssub.__aenter__', 'solvecdp/core.py'),
|
|
50
|
-
'solvecdp.core.JsSub.__aexit__': ('core.html#jssub.__aexit__', 'solvecdp/core.py'),
|
|
51
|
-
'solvecdp.core.JsSub.__call__': ('core.html#jssub.__call__', 'solvecdp/core.py'),
|
|
52
|
-
'solvecdp.core.JsSub.__init__': ('core.html#jssub.__init__', 'solvecdp/core.py'),
|
|
53
|
-
'solvecdp.core._cmd_doc': ('core.html#_cmd_doc', 'solvecdp/core.py'),
|
|
54
|
-
'solvecdp.core._cmd_sig': ('core.html#_cmd_sig', 'solvecdp/core.py'),
|
|
55
|
-
'solvecdp.core._find_cmd': ('core.html#_find_cmd', 'solvecdp/core.py'),
|
|
56
|
-
'solvecdp.core._lower1': ('core.html#_lower1', 'solvecdp/core.py'),
|
|
57
|
-
'solvecdp.core._simplify': ('core.html#_simplify', 'solvecdp/core.py'),
|
|
58
|
-
'solvecdp.core._upper1': ('core.html#_upper1', 'solvecdp/core.py'),
|
|
59
|
-
'solvecdp.core.build_ax_tree': ('core.html#build_ax_tree', 'solvecdp/core.py'),
|
|
60
|
-
'solvecdp.core.cdp_search': ('core.html#cdp_search', 'solvecdp/core.py'),
|
|
61
|
-
'solvecdp.core.cdp_yolo': ('core.html#cdp_yolo', 'solvecdp/core.py'),
|
|
62
|
-
'solvecdp.core.js_cdp': ('core.html#js_cdp', 'solvecdp/core.py')}}}
|