Skip to content

Commit 09492f7

Browse files
authored
Merge pull request #17 from kamildemocko/develop
Develop
2 parents 3a511e8 + 906faee commit 09492f7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Documentation = "https://kamildemocko.github.io/pysapscript/"
1616

1717
[tool.poetry]
1818
name = "pysapscript"
19-
version = "3.0.3"
19+
version = "3.1.0"
2020
description = "Automate SAP with python!"
2121
authors = ["Kamil Democko <[email protected]>"]
2222
readme = "README.md"

pysapscript/window.py

+18
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,24 @@ def visualize(self, element: str, seconds: int = 1) -> None:
247247
f"Error visualizing element {element}: {e}"
248248
)
249249

250+
def exists(self, element: str) -> bool:
251+
"""
252+
checks if element exists by trying to access it
253+
254+
Args:
255+
element (str): element to check
256+
257+
Returns:
258+
bool: True if element exists, False otherwise
259+
"""
260+
261+
try:
262+
self.session_handle.findById(element)
263+
return True
264+
265+
except Exception:
266+
return False
267+
250268
def send_v_key(
251269
self,
252270
element: str = "wnd[0]",

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ selected = window.is_selected(element)
8383
window.read(element)
8484
window.set_checkbox(value)
8585
window.visualize(element[, seconds=1])
86+
window.exists(element)
8687

8788
table: ShellTable = window.read_shell_table(element)
8889
html_content = window.read_html_viewer(element)

0 commit comments

Comments
 (0)