simplex 1.2.71__tar.gz → 1.2.72__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.
Potentially problematic release.
This version of simplex might be problematic. Click here for more details.
- {simplex-1.2.71 → simplex-1.2.72}/PKG-INFO +1 -1
- {simplex-1.2.71 → simplex-1.2.72}/setup.py +1 -1
- {simplex-1.2.71 → simplex-1.2.72}/simplex/simplex.py +86 -43
- {simplex-1.2.71 → simplex-1.2.72}/simplex.egg-info/PKG-INFO +1 -1
- {simplex-1.2.71 → simplex-1.2.72}/LICENSE +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/README.md +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/setup.cfg +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex/__init__.py +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex/cli.py +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex/deploy/push.py +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex.egg-info/SOURCES.txt +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex.egg-info/requires.txt +0 -0
- {simplex-1.2.71 → simplex-1.2.72}/simplex.egg-info/top_level.txt +0 -0
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import json
|
|
4
4
|
import warnings
|
|
5
5
|
import requests
|
|
6
|
-
|
|
6
|
+
import time
|
|
7
7
|
try:
|
|
8
8
|
from rebrowser_playwright.sync_api import sync_playwright
|
|
9
9
|
PLAYWRIGHT_AVAILABLE = True
|
|
@@ -169,7 +169,7 @@ class Simplex:
|
|
|
169
169
|
|
|
170
170
|
return self.session_id, livestream_url
|
|
171
171
|
|
|
172
|
-
def goto(self, url: str):
|
|
172
|
+
def goto(self, url: str, override_fail_state: bool = False):
|
|
173
173
|
if not self.session_id:
|
|
174
174
|
raise ValueError(f"Must call create_session before calling action goto with url='{url}'")
|
|
175
175
|
|
|
@@ -178,7 +178,8 @@ class Simplex:
|
|
|
178
178
|
|
|
179
179
|
data = {
|
|
180
180
|
'url': url,
|
|
181
|
-
'session_id': self.session_id
|
|
181
|
+
'session_id': self.session_id,
|
|
182
|
+
'override_fail_state': override_fail_state
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
response = requests.post(
|
|
@@ -195,8 +196,33 @@ class Simplex:
|
|
|
195
196
|
return
|
|
196
197
|
else:
|
|
197
198
|
raise ValueError(f"Failed to goto url: {response.json()['error']}")
|
|
199
|
+
|
|
200
|
+
def enqueue_actions(self, actions: list):
|
|
201
|
+
if not self.session_id:
|
|
202
|
+
raise ValueError(f"Must call create_session before calling action enqueue_actions with actions={actions}")
|
|
203
|
+
|
|
204
|
+
data = {
|
|
205
|
+
'actions': json.dumps(actions),
|
|
206
|
+
'session_id': self.session_id,
|
|
207
|
+
}
|
|
198
208
|
|
|
199
|
-
|
|
209
|
+
response = requests.post(
|
|
210
|
+
f"{BASE_URL}/enqueue_actions",
|
|
211
|
+
headers={
|
|
212
|
+
'x-api-key': self.api_key
|
|
213
|
+
},
|
|
214
|
+
data=data
|
|
215
|
+
)
|
|
216
|
+
if 'succeeded' not in response.json():
|
|
217
|
+
raise ValueError(f"It looks like the enqueue_actions action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
218
|
+
|
|
219
|
+
if response.json()['succeeded']:
|
|
220
|
+
return
|
|
221
|
+
else:
|
|
222
|
+
raise ValueError(f"Failed to enqueue actions: {response.json()['error']}")
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def click(self, element_description: str, override_fail_state: bool = False):
|
|
200
226
|
if not element_description or not element_description.strip():
|
|
201
227
|
raise ValueError("element_description cannot be empty")
|
|
202
228
|
if not self.session_id:
|
|
@@ -204,7 +230,8 @@ class Simplex:
|
|
|
204
230
|
|
|
205
231
|
data = {
|
|
206
232
|
'element_description': element_description,
|
|
207
|
-
'session_id': self.session_id
|
|
233
|
+
'session_id': self.session_id,
|
|
234
|
+
'override_fail_state': override_fail_state
|
|
208
235
|
}
|
|
209
236
|
|
|
210
237
|
response = requests.post(
|
|
@@ -221,7 +248,7 @@ class Simplex:
|
|
|
221
248
|
else:
|
|
222
249
|
raise ValueError(f"Failed to click element: {response.json()['error']}")
|
|
223
250
|
|
|
224
|
-
def select_dropdown_option(self, element_description: str):
|
|
251
|
+
def select_dropdown_option(self, element_description: str, override_fail_state: bool = False):
|
|
225
252
|
if not element_description or not element_description.strip():
|
|
226
253
|
raise ValueError("element_description cannot be empty")
|
|
227
254
|
if not self.session_id:
|
|
@@ -229,7 +256,8 @@ class Simplex:
|
|
|
229
256
|
|
|
230
257
|
data = {
|
|
231
258
|
'element_description': element_description,
|
|
232
|
-
'session_id': self.session_id
|
|
259
|
+
'session_id': self.session_id,
|
|
260
|
+
'override_fail_state': override_fail_state
|
|
233
261
|
}
|
|
234
262
|
|
|
235
263
|
response = requests.post(
|
|
@@ -247,7 +275,7 @@ class Simplex:
|
|
|
247
275
|
else:
|
|
248
276
|
raise ValueError(f"Failed to select dropdown option: {response.json()['error']}")
|
|
249
277
|
|
|
250
|
-
def scroll_to_element(self, element_description: str):
|
|
278
|
+
def scroll_to_element(self, element_description: str, override_fail_state: bool = False):
|
|
251
279
|
if not element_description or not element_description.strip():
|
|
252
280
|
raise ValueError("element_description cannot be empty")
|
|
253
281
|
if not self.session_id:
|
|
@@ -255,7 +283,8 @@ class Simplex:
|
|
|
255
283
|
|
|
256
284
|
data = {
|
|
257
285
|
'element_description': element_description,
|
|
258
|
-
'session_id': self.session_id
|
|
286
|
+
'session_id': self.session_id,
|
|
287
|
+
'override_fail_state': override_fail_state
|
|
259
288
|
}
|
|
260
289
|
|
|
261
290
|
response = requests.post(
|
|
@@ -273,7 +302,7 @@ class Simplex:
|
|
|
273
302
|
else:
|
|
274
303
|
raise ValueError(f"Failed to scroll element into view: {response.json()['error']}")
|
|
275
304
|
|
|
276
|
-
def hover(self, element_description: str):
|
|
305
|
+
def hover(self, element_description: str, override_fail_state: bool = False):
|
|
277
306
|
if not element_description or not element_description.strip():
|
|
278
307
|
raise ValueError("element_description cannot be empty")
|
|
279
308
|
if not self.session_id:
|
|
@@ -281,7 +310,8 @@ class Simplex:
|
|
|
281
310
|
|
|
282
311
|
data = {
|
|
283
312
|
'element_description': element_description,
|
|
284
|
-
'session_id': self.session_id
|
|
313
|
+
'session_id': self.session_id,
|
|
314
|
+
'override_fail_state': override_fail_state
|
|
285
315
|
}
|
|
286
316
|
|
|
287
317
|
response = requests.post(
|
|
@@ -299,7 +329,7 @@ class Simplex:
|
|
|
299
329
|
else:
|
|
300
330
|
raise ValueError(f"Failed to hover: {response.json()['error']}")
|
|
301
331
|
|
|
302
|
-
def type(self, text: str):
|
|
332
|
+
def type(self, text: str, override_fail_state: bool = False):
|
|
303
333
|
if not text or not text.strip():
|
|
304
334
|
raise ValueError("text cannot be empty")
|
|
305
335
|
if not self.session_id:
|
|
@@ -307,7 +337,8 @@ class Simplex:
|
|
|
307
337
|
|
|
308
338
|
data = {
|
|
309
339
|
'text': text,
|
|
310
|
-
'session_id': self.session_id
|
|
340
|
+
'session_id': self.session_id,
|
|
341
|
+
'override_fail_state': override_fail_state
|
|
311
342
|
}
|
|
312
343
|
|
|
313
344
|
response = requests.post(
|
|
@@ -322,12 +353,13 @@ class Simplex:
|
|
|
322
353
|
else:
|
|
323
354
|
raise ValueError(f"Failed to type text: {response.json()['error']}")
|
|
324
355
|
|
|
325
|
-
def reload(self):
|
|
356
|
+
def reload(self, override_fail_state: bool = False):
|
|
326
357
|
if not self.session_id:
|
|
327
358
|
raise ValueError("Must call create_session before calling action reload")
|
|
328
359
|
|
|
329
360
|
data = {
|
|
330
|
-
'session_id': self.session_id
|
|
361
|
+
'session_id': self.session_id,
|
|
362
|
+
'override_fail_state': override_fail_state
|
|
331
363
|
}
|
|
332
364
|
|
|
333
365
|
response = requests.post(
|
|
@@ -344,12 +376,13 @@ class Simplex:
|
|
|
344
376
|
else:
|
|
345
377
|
raise ValueError(f"Failed to reload: {response.json()['error']}")
|
|
346
378
|
|
|
347
|
-
def press_enter(self):
|
|
379
|
+
def press_enter(self, override_fail_state: bool = False):
|
|
348
380
|
if not self.session_id:
|
|
349
381
|
raise ValueError("Must call create_session before calling action press_enter")
|
|
350
382
|
|
|
351
383
|
data = {
|
|
352
|
-
'session_id': self.session_id
|
|
384
|
+
'session_id': self.session_id,
|
|
385
|
+
'override_fail_state': override_fail_state
|
|
353
386
|
}
|
|
354
387
|
|
|
355
388
|
response = requests.post(
|
|
@@ -366,12 +399,13 @@ class Simplex:
|
|
|
366
399
|
else:
|
|
367
400
|
raise ValueError(f"Failed to press enter: {response.json()['error']}")
|
|
368
401
|
|
|
369
|
-
def press_tab(self):
|
|
402
|
+
def press_tab(self, override_fail_state: bool = False):
|
|
370
403
|
if not self.session_id:
|
|
371
404
|
raise ValueError("Must call create_session before calling action press_tab")
|
|
372
405
|
|
|
373
406
|
data = {
|
|
374
|
-
'session_id': self.session_id
|
|
407
|
+
'session_id': self.session_id,
|
|
408
|
+
'override_fail_state': override_fail_state
|
|
375
409
|
}
|
|
376
410
|
|
|
377
411
|
response = requests.post(
|
|
@@ -388,12 +422,13 @@ class Simplex:
|
|
|
388
422
|
else:
|
|
389
423
|
raise ValueError(f"Failed to press tab: {response.json()['error']}")
|
|
390
424
|
|
|
391
|
-
def delete_text(self):
|
|
425
|
+
def delete_text(self, override_fail_state: bool = False):
|
|
392
426
|
if not self.session_id:
|
|
393
427
|
raise ValueError("Must call create_session before calling action delete_text")
|
|
394
428
|
|
|
395
429
|
data = {
|
|
396
|
-
'session_id': self.session_id
|
|
430
|
+
'session_id': self.session_id,
|
|
431
|
+
'override_fail_state': override_fail_state
|
|
397
432
|
}
|
|
398
433
|
|
|
399
434
|
response = requests.post(
|
|
@@ -410,12 +445,13 @@ class Simplex:
|
|
|
410
445
|
else:
|
|
411
446
|
raise ValueError(f"Failed to delete text: {response.json()['error']}")
|
|
412
447
|
|
|
413
|
-
def bot_tests(self):
|
|
448
|
+
def bot_tests(self, override_fail_state: bool = False):
|
|
414
449
|
if not self.session_id:
|
|
415
450
|
raise ValueError("Must call create_session before calling action bot_tests")
|
|
416
451
|
|
|
417
452
|
data = {
|
|
418
|
-
'session_id': self.session_id
|
|
453
|
+
'session_id': self.session_id,
|
|
454
|
+
'override_fail_state': override_fail_state
|
|
419
455
|
}
|
|
420
456
|
|
|
421
457
|
response = requests.post(
|
|
@@ -432,7 +468,7 @@ class Simplex:
|
|
|
432
468
|
else:
|
|
433
469
|
raise ValueError(f"Failed to run bot tests: {response.json()['error']}")
|
|
434
470
|
|
|
435
|
-
def extract_text(self, element_description: str):
|
|
471
|
+
def extract_text(self, element_description: str, override_fail_state: bool = False):
|
|
436
472
|
if not element_description or not element_description.strip():
|
|
437
473
|
raise ValueError("element_description cannot be empty")
|
|
438
474
|
if not self.session_id:
|
|
@@ -440,7 +476,8 @@ class Simplex:
|
|
|
440
476
|
|
|
441
477
|
data = {
|
|
442
478
|
'element_description': element_description,
|
|
443
|
-
'session_id': self.session_id
|
|
479
|
+
'session_id': self.session_id,
|
|
480
|
+
'override_fail_state': override_fail_state
|
|
444
481
|
}
|
|
445
482
|
|
|
446
483
|
response = requests.post(
|
|
@@ -458,13 +495,14 @@ class Simplex:
|
|
|
458
495
|
else:
|
|
459
496
|
raise ValueError(f"Failed to extract text: {response_json['error']}")
|
|
460
497
|
|
|
461
|
-
def scroll(self, pixels: float):
|
|
498
|
+
def scroll(self, pixels: float, override_fail_state: bool = False):
|
|
462
499
|
if not self.session_id:
|
|
463
500
|
raise ValueError(f"Must call create_session before calling action scroll with pixels={pixels}")
|
|
464
501
|
|
|
465
502
|
data = {
|
|
466
503
|
'pixels': pixels,
|
|
467
|
-
'session_id': self.session_id
|
|
504
|
+
'session_id': self.session_id,
|
|
505
|
+
'override_fail_state': override_fail_state
|
|
468
506
|
}
|
|
469
507
|
|
|
470
508
|
response = requests.post(
|
|
@@ -481,15 +519,15 @@ class Simplex:
|
|
|
481
519
|
else:
|
|
482
520
|
raise ValueError(f"Failed to scroll: {response.json()['error']}")
|
|
483
521
|
|
|
484
|
-
def wait(self, milliseconds: int):
|
|
522
|
+
def wait(self, milliseconds: int, override_fail_state: bool = False):
|
|
485
523
|
if not self.session_id:
|
|
486
524
|
raise ValueError(f"Must call create_session before calling action wait with milliseconds={milliseconds}")
|
|
487
525
|
|
|
488
526
|
data = {
|
|
489
527
|
'milliseconds': milliseconds,
|
|
490
|
-
'session_id': self.session_id
|
|
528
|
+
'session_id': self.session_id,
|
|
529
|
+
'override_fail_state': override_fail_state
|
|
491
530
|
}
|
|
492
|
-
|
|
493
531
|
response = requests.post(
|
|
494
532
|
f"{BASE_URL}/wait",
|
|
495
533
|
headers={
|
|
@@ -503,7 +541,7 @@ class Simplex:
|
|
|
503
541
|
return
|
|
504
542
|
else:
|
|
505
543
|
raise ValueError(f"Failed to wait: {response.json()['error']}")
|
|
506
|
-
|
|
544
|
+
|
|
507
545
|
def create_login_session(self, url: str, save_directory: Optional[str] = None):
|
|
508
546
|
if not PLAYWRIGHT_AVAILABLE:
|
|
509
547
|
raise ImportError("This feature requires playwright. Install simplex[playwright] to use it.")
|
|
@@ -661,11 +699,12 @@ class Simplex:
|
|
|
661
699
|
else:
|
|
662
700
|
raise ValueError(f"Failed to restore login session: {response.json()['error']}")
|
|
663
701
|
|
|
664
|
-
def click_and_upload(self, element_description: str, file_path_or_callable: Union[str, callable]):
|
|
702
|
+
def click_and_upload(self, element_description: str, file_path_or_callable: Union[str, callable], override_fail_state: bool = False):
|
|
665
703
|
"""
|
|
666
704
|
Args:
|
|
667
705
|
element_description: Description of the element to click and upload to
|
|
668
706
|
file_path_or_callable: Either a path to the file to be uploaded or a callable that returns a file-like object in 'rb' mode
|
|
707
|
+
override_fail_state: Boolean to override fail state, default is False
|
|
669
708
|
"""
|
|
670
709
|
if not element_description or not element_description.strip():
|
|
671
710
|
raise ValueError("element_description cannot be empty")
|
|
@@ -687,7 +726,8 @@ class Simplex:
|
|
|
687
726
|
raise ValueError("You must provide either a valid file path or a callable that returns a file-like object.")
|
|
688
727
|
data = {
|
|
689
728
|
'element_description': element_description,
|
|
690
|
-
'session_id': self.session_id
|
|
729
|
+
'session_id': self.session_id,
|
|
730
|
+
'override_fail_state': override_fail_state
|
|
691
731
|
}
|
|
692
732
|
|
|
693
733
|
response = requests.post(
|
|
@@ -705,18 +745,18 @@ class Simplex:
|
|
|
705
745
|
else:
|
|
706
746
|
raise ValueError(f"Failed to click and upload: {response.json()['error']}")
|
|
707
747
|
|
|
708
|
-
def click_and_download(self, element_description: str):
|
|
748
|
+
def click_and_download(self, element_description: str, override_fail_state: bool = False):
|
|
709
749
|
if not element_description or not element_description.strip():
|
|
710
750
|
raise ValueError("element_description cannot be empty")
|
|
711
751
|
if not self.session_id:
|
|
712
752
|
raise ValueError(f"Must call create_session before calling action click_and_download with element_description='{element_description}'")
|
|
713
753
|
|
|
714
754
|
data = {
|
|
715
|
-
'element_description': element_description
|
|
755
|
+
'element_description': element_description,
|
|
756
|
+
'session_id': self.session_id,
|
|
757
|
+
'override_fail_state': override_fail_state
|
|
716
758
|
}
|
|
717
759
|
|
|
718
|
-
data['session_id'] = self.session_id
|
|
719
|
-
|
|
720
760
|
response = requests.post(
|
|
721
761
|
f"{BASE_URL}/click_and_download",
|
|
722
762
|
headers={
|
|
@@ -753,7 +793,7 @@ class Simplex:
|
|
|
753
793
|
|
|
754
794
|
return filename, response.content
|
|
755
795
|
|
|
756
|
-
def exists(self, element_description: str):
|
|
796
|
+
def exists(self, element_description: str, override_fail_state: bool = False):
|
|
757
797
|
if not element_description or not element_description.strip():
|
|
758
798
|
raise ValueError("element_description cannot be empty")
|
|
759
799
|
if not self.session_id:
|
|
@@ -761,7 +801,8 @@ class Simplex:
|
|
|
761
801
|
|
|
762
802
|
data = {
|
|
763
803
|
'element_description': element_description,
|
|
764
|
-
'session_id': self.session_id
|
|
804
|
+
'session_id': self.session_id,
|
|
805
|
+
'override_fail_state': override_fail_state
|
|
765
806
|
}
|
|
766
807
|
|
|
767
808
|
response = requests.post(
|
|
@@ -780,9 +821,10 @@ class Simplex:
|
|
|
780
821
|
else:
|
|
781
822
|
raise ValueError(f"Failed to check if element exists: {response_json['error']}")
|
|
782
823
|
|
|
783
|
-
def capture_login_session(self):
|
|
824
|
+
def capture_login_session(self, override_fail_state: bool = False):
|
|
784
825
|
data = {
|
|
785
|
-
'session_id': self.session_id
|
|
826
|
+
'session_id': self.session_id,
|
|
827
|
+
'override_fail_state': override_fail_state
|
|
786
828
|
}
|
|
787
829
|
response = requests.post(
|
|
788
830
|
f"{BASE_URL}/capture_login_session",
|
|
@@ -803,9 +845,10 @@ class Simplex:
|
|
|
803
845
|
raise ValueError(f"Failed to capture login session: {response_json['error']}")
|
|
804
846
|
|
|
805
847
|
|
|
806
|
-
def get_page_url(self):
|
|
848
|
+
def get_page_url(self, override_fail_state: bool = False):
|
|
807
849
|
data = {
|
|
808
|
-
'session_id': self.session_id
|
|
850
|
+
'session_id': self.session_id,
|
|
851
|
+
'override_fail_state': override_fail_state
|
|
809
852
|
}
|
|
810
853
|
|
|
811
854
|
response = requests.post(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|