simplex 1.2.33__py3-none-any.whl → 1.2.34__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 CHANGED
@@ -5,12 +5,63 @@ BASE_URL = "https://api.simplex.sh"
5
5
 
6
6
  import json
7
7
 
8
+ class Playwright:
9
+ def __init__(self, simplex_instance):
10
+ self.simplex = simplex_instance
11
+
12
+ def click(self, locator: str, locator_type: str, exact: Optional[bool] = False,
13
+ element_index: Optional[str] = None, nth_index: Optional[int] = None,
14
+ locator_options: Optional[dict] = None):
15
+
16
+ if element_index and element_index not in ["first", "last", "nth"]:
17
+ raise ValueError("element_index must be 'first', 'last', or 'nth'")
18
+
19
+ if element_index=="nth" and not nth_index:
20
+ raise ValueError("nth_index is required when element_index is 'nth'")
21
+
22
+ data = {
23
+ 'session_id': self.simplex.session_id,
24
+ 'locator': locator,
25
+ 'locator_type': locator_type,
26
+ }
27
+
28
+ if element_index:
29
+ data['element_index'] = element_index
30
+ data['nth_index'] = nth_index
31
+
32
+ if exact:
33
+ data['exact'] = exact
34
+
35
+ if locator_options:
36
+ data['locator_options'] = json.dumps(locator_options)
37
+
38
+ response = requests.post(
39
+ f"{BASE_URL}/playwright/click",
40
+ headers={
41
+ 'x-api-key': self.simplex.api_key
42
+ },
43
+ data=data
44
+ )
45
+
46
+ if 'succeeded' not in response.json():
47
+ print(response.json())
48
+ raise ValueError(f"It looks like the click action with playwright failed to return a response. Did you set your api_key when creating the Simplex class?")
49
+
50
+ if response.json()["succeeded"]:
51
+ return
52
+ else:
53
+ raise ValueError(f"Failed to click element: {response.json()['error']}")
54
+
55
+
56
+
8
57
  class Simplex:
9
58
  def __init__(self, api_key: str):
10
59
  self.api_key = api_key
11
60
  self.session_id = None
12
61
  atexit.register(self.close_session)
13
62
 
63
+ self.playwright = Playwright(self)
64
+
14
65
  def close_session(self):
15
66
  if not self.session_id:
16
67
  return
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: simplex
3
- Version: 1.2.33
3
+ Version: 1.2.34
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -17,15 +17,6 @@ Requires-Dist: colorama
17
17
  Requires-Dist: requests
18
18
  Requires-Dist: python-dotenv
19
19
  Requires-Dist: click
20
- Dynamic: author
21
- Dynamic: author-email
22
- Dynamic: classifier
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: home-page
26
- Dynamic: requires-dist
27
- Dynamic: requires-python
28
- Dynamic: summary
29
20
 
30
21
  # Simplex AI Python SDK
31
22
 
@@ -0,0 +1,11 @@
1
+ simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
2
+ simplex/cli.py,sha256=FlZPWx014wpIy3TWYxhv8pANoPG9UWoq-ipkEIaiJAU,2389
3
+ simplex/simplex.py,sha256=6v_n8ZRIt2cGvD0rIvSMHCVnhdCtuAApa7dN4pbiVq4,19430
4
+ simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
5
+ simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
6
+ simplex-1.2.34.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
7
+ simplex-1.2.34.dist-info/METADATA,sha256=oA_Yw_pcITBfU-8iclXVTm7bBTmt-Lh76L06HjNsERA,741
8
+ simplex-1.2.34.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
9
+ simplex-1.2.34.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
10
+ simplex-1.2.34.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
11
+ simplex-1.2.34.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +0,0 @@
1
- simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
2
- simplex/cli.py,sha256=FlZPWx014wpIy3TWYxhv8pANoPG9UWoq-ipkEIaiJAU,2389
3
- simplex/simplex.py,sha256=jYmeXQx09FneIl9_XjLWJ0v_EvY6jqlwHCmMoJYPkTE,17653
4
- simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
5
- simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
6
- simplex-1.2.33.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
7
- simplex-1.2.33.dist-info/METADATA,sha256=EVVVPa7m5G4P9ZK2UCAQRCSa6iFtDNeyqV8qbJLYTnI,938
8
- simplex-1.2.33.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
- simplex-1.2.33.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
10
- simplex-1.2.33.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
11
- simplex-1.2.33.dist-info/RECORD,,