simplex 1.2.1__py3-none-any.whl → 1.2.2__py3-none-any.whl
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.
Potentially problematic release.
This version of simplex might be problematic. Click here for more details.
- simplex/simplex.py +20 -8
- {simplex-1.2.1.dist-info → simplex-1.2.2.dist-info}/METADATA +3 -12
- simplex-1.2.2.dist-info/RECORD +9 -0
- {simplex-1.2.1.dist-info → simplex-1.2.2.dist-info}/WHEEL +1 -1
- simplex/constants.py +0 -1
- simplex-1.2.1.dist-info/RECORD +0 -10
- {simplex-1.2.1.dist-info → simplex-1.2.2.dist-info}/LICENSE +0 -0
- {simplex-1.2.1.dist-info → simplex-1.2.2.dist-info}/entry_points.txt +0 -0
- {simplex-1.2.1.dist-info → simplex-1.2.2.dist-info}/top_level.txt +0 -0
simplex/simplex.py
CHANGED
|
@@ -26,10 +26,9 @@ class Simplex:
|
|
|
26
26
|
self.driver = self.browser.new_page()
|
|
27
27
|
else:
|
|
28
28
|
self.playwright = None
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
self.driver = self.browser.new_page()
|
|
29
|
+
self.driver = self.browser.contexts[0].pages[0]
|
|
30
|
+
self.driver.set_default_navigation_timeout(0)
|
|
31
|
+
self.driver.set_default_timeout(0)
|
|
33
32
|
|
|
34
33
|
def find_element(self, element_description: str, state: Image.Image | None = None, annotate: bool = True) -> List[int]:
|
|
35
34
|
"""
|
|
@@ -42,6 +41,7 @@ class Simplex:
|
|
|
42
41
|
Returns:
|
|
43
42
|
bounding_box (tuple): [x1, y1, x2, y2] bounding box of the found element
|
|
44
43
|
"""
|
|
44
|
+
print(f"Finding element \"{element_description}\"...")
|
|
45
45
|
if state is None:
|
|
46
46
|
state = self.take_stable_screenshot()
|
|
47
47
|
|
|
@@ -58,7 +58,7 @@ class Simplex:
|
|
|
58
58
|
'element_description': (None, element_description),
|
|
59
59
|
'api_key': (None, self.api_key)
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
print("Sending screenshot to server...")
|
|
62
62
|
# Make the request
|
|
63
63
|
response = requests.post(
|
|
64
64
|
endpoint,
|
|
@@ -122,6 +122,7 @@ class Simplex:
|
|
|
122
122
|
}
|
|
123
123
|
""", bbox)
|
|
124
124
|
self.driver.wait_for_selector('#simplex-bbox-overlay')
|
|
125
|
+
print(f"Found element \"{element_description}\" at pixel coordinates {bbox}.")
|
|
125
126
|
return bbox
|
|
126
127
|
else:
|
|
127
128
|
print("Error:", response.text)
|
|
@@ -182,6 +183,8 @@ class Simplex:
|
|
|
182
183
|
"""
|
|
183
184
|
if new_tab:
|
|
184
185
|
self.driver = self.browser.new_page()
|
|
186
|
+
self.driver.wait_for_load_state()
|
|
187
|
+
print(f"Navigating to URL {url}...")
|
|
185
188
|
self.driver.goto(url)
|
|
186
189
|
|
|
187
190
|
def execute_action(self, action: List[List[str]], state: Image.Image | None = None, annotate: bool = True) -> None:
|
|
@@ -191,10 +194,8 @@ class Simplex:
|
|
|
191
194
|
Args:
|
|
192
195
|
action (List[List[str]]): List of actions to perform
|
|
193
196
|
"""
|
|
197
|
+
print(f"Executing action {action}...")
|
|
194
198
|
action_type, description = action
|
|
195
|
-
if state is None:
|
|
196
|
-
state = self.take_stable_screenshot()
|
|
197
|
-
|
|
198
199
|
try:
|
|
199
200
|
if action_type == "CLICK":
|
|
200
201
|
bbox = self.find_element(description, state, annotate=annotate)
|
|
@@ -207,6 +208,7 @@ class Simplex:
|
|
|
207
208
|
self.driver.mouse.move(center_x, center_y)
|
|
208
209
|
|
|
209
210
|
elif action_type == "TYPE":
|
|
211
|
+
print(f"Typing \"{description}\"...")
|
|
210
212
|
self.driver.keyboard.type(description)
|
|
211
213
|
|
|
212
214
|
elif action_type == "ENTER":
|
|
@@ -217,6 +219,7 @@ class Simplex:
|
|
|
217
219
|
|
|
218
220
|
elif action_type == "WAIT":
|
|
219
221
|
self.driver.wait_for_timeout(int(description))
|
|
222
|
+
|
|
220
223
|
|
|
221
224
|
except Exception as e:
|
|
222
225
|
print(f"Error executing action: {e}")
|
|
@@ -230,6 +233,14 @@ class Simplex:
|
|
|
230
233
|
actions = self.step_to_action(step_description, state)
|
|
231
234
|
for action in actions:
|
|
232
235
|
self.execute_action(action, annotate=annotate)
|
|
236
|
+
|
|
237
|
+
def extract(self, step_description: str, annotate: bool = True) -> None:
|
|
238
|
+
"""
|
|
239
|
+
Extract an element from the page
|
|
240
|
+
"""
|
|
241
|
+
state = self.take_stable_screenshot()
|
|
242
|
+
|
|
243
|
+
# self.execute_action(action, annotate=annotate)
|
|
233
244
|
|
|
234
245
|
def take_stable_screenshot(self) -> Image.Image:
|
|
235
246
|
"""
|
|
@@ -238,6 +249,7 @@ class Simplex:
|
|
|
238
249
|
Returns:
|
|
239
250
|
PIL.Image.Image: Screenshot of the current page
|
|
240
251
|
"""
|
|
252
|
+
print("Taking screenshot of the page...")
|
|
241
253
|
self.driver.wait_for_load_state('networkidle')
|
|
242
254
|
return screenshot_to_image(self.driver.screenshot())
|
|
243
255
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://github.com/shreyka/simplex-python
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -18,18 +18,9 @@ Requires-Dist: python-dotenv>=0.19.0
|
|
|
18
18
|
Requires-Dist: tiktoken>=0.5.0
|
|
19
19
|
Requires-Dist: click>=8.0.0
|
|
20
20
|
Requires-Dist: rich>=13.0.0
|
|
21
|
-
Requires-Dist:
|
|
21
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
22
22
|
Requires-Dist: playwright>=1.0.0
|
|
23
23
|
Requires-Dist: Pillow>=9.0.0
|
|
24
|
-
Dynamic: author
|
|
25
|
-
Dynamic: author-email
|
|
26
|
-
Dynamic: classifier
|
|
27
|
-
Dynamic: description
|
|
28
|
-
Dynamic: description-content-type
|
|
29
|
-
Dynamic: home-page
|
|
30
|
-
Dynamic: requires-dist
|
|
31
|
-
Dynamic: requires-python
|
|
32
|
-
Dynamic: summary
|
|
33
24
|
|
|
34
25
|
# Simplex AI Python SDK
|
|
35
26
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
simplex/__init__.py,sha256=1mbM4XUk0FNW161WOkM4ayC1s_QSsaBEls6PZ0iBScY,74
|
|
2
|
+
simplex/simplex.py,sha256=___oQuVrlTYR3BJDxb0INKHQO74aSqeNZyCkj8NzdYQ,9856
|
|
3
|
+
simplex/utils.py,sha256=UrD4Ena3yk0POmxxyiqMszzPbTscTCJpMP4xZFDAuOc,339
|
|
4
|
+
simplex-1.2.2.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
5
|
+
simplex-1.2.2.dist-info/METADATA,sha256=cRRdYjOEPq-fkUDokBgx8Sas49liFjB6BLo4Ypv1dG0,917
|
|
6
|
+
simplex-1.2.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
7
|
+
simplex-1.2.2.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
8
|
+
simplex-1.2.2.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
9
|
+
simplex-1.2.2.dist-info/RECORD,,
|
simplex/constants.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
BASE_URL = "https://u3mvtbirxf.us-east-1.awsapprunner.com"
|
simplex-1.2.1.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
simplex/__init__.py,sha256=1mbM4XUk0FNW161WOkM4ayC1s_QSsaBEls6PZ0iBScY,74
|
|
2
|
-
simplex/constants.py,sha256=nIXF2oVNNNknXweXAlmE-KBM9QjJtYw9osXVYjvloN0,59
|
|
3
|
-
simplex/simplex.py,sha256=8LTbvMJUbIWdyAqRKkius-R4PFHZBf4RW_bQZmwd5AY,9275
|
|
4
|
-
simplex/utils.py,sha256=UrD4Ena3yk0POmxxyiqMszzPbTscTCJpMP4xZFDAuOc,339
|
|
5
|
-
simplex-1.2.1.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
6
|
-
simplex-1.2.1.dist-info/METADATA,sha256=u9gF-wpSwjx0DfsrE5XM-7aRrmFyO5X-6LQ1RagF0tc,1114
|
|
7
|
-
simplex-1.2.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
8
|
-
simplex-1.2.1.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
9
|
-
simplex-1.2.1.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
10
|
-
simplex-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|