Browse Source

forcetextJS method (not ready)

bernhardbuhl 3 years ago
parent
commit
c2a43f9b70
3 changed files with 9 additions and 2 deletions
  1. 7 1
      baangt/base/BrowserHandling/BrowserHandling.py
  2. 1 0
      requirements.txt
  3. 1 1
      setup.py

+ 7 - 1
baangt/base/BrowserHandling/BrowserHandling.py

@@ -527,18 +527,24 @@ class BrowserDriver:
         """
         Identifies the object via JS and set's the desired value via JS
         """
+        # element, html = self.findBy(id=id ,css=css, xpath=xpath, class_name=class_name, iframe=iframe,
+        # timeout=timeout, optional=optional)
+        # didn't work to give the element to JavaScript-method
+
         xpath = xpath.replace('"', "'")
         xpath = xpath.replace("'", "\\'")
         lJSText = "\n".join(
             [f"var zzbaangt = document.evaluate('{xpath}', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);",
              "if (zzbaangt.snapshotLength > 0) { ",
-             f"zzbaangt.value='{value}';",
+             f"zzbaangt[0].value='{value}';",
              "};",
              f""
             ]
         )
         logger.debug(f"Setting element using JS-Text: {lJSText}")
 
+        # lJSText = f"arguments[0].value='{value}';" --> Didn't work with Element.
+
         self.javaScript(lJSText)
 
     def setBrowserWindowSize(self, browserWindowSize: str):

+ 1 - 0
requirements.txt

@@ -7,6 +7,7 @@ faker>=4.0.2
 gevent>=1.5.0
 lxml>=4.5.0
 openpyxl>=3.0.3
+pandas>=1.1.1
 Pillow>=7.1.2
 pyperclip>=1.8.0
 pluggy>=0.13.1

+ 1 - 1
setup.py

@@ -20,7 +20,7 @@ if __name__ == '__main__':
                           "dataclasses", "dataclasses-json",
                           "faker",  "gevent", "jinja2", "lxml",
                           "openpyxl",
-                          "Pillow", "pluggy", "pyperclip",  "pyQT5==5.14.2",
+                          "pandas", "Pillow", "pluggy", "pyperclip",  "pyQT5==5.14.2",
                           "requests", "requests-toolbelt",
                           "schwifty", "selenium", "sqlalchemy",
                           "urllib3", "psutil", "pymsteams", "slack-webhook",