Skip to main content

pyseleniumbot - a wrapper based on selenium python

Project description

b'# Python Selenium Actionbot wrapper\r\n## Currently supporting functions\r\n### webelement functions \r\n\r\n python\r\n\r\n def findElementsBy(self, xpath):\r\n ...\r\n\r\n def findElementBy(self, xpath):\r\n ...\r\n\r\n def click(self, xpath):\r\n ...\r\n\r\n def clear(self, xpath):\r\n ... \r\n \r\n \r\n def isClickable(self, xpath, index=None):\r\n ...\r\n \r\n \'\'\'\r\n Simulates typing into the element.\r\n\r\n Args:\t\r\n value - A string for typing, or setting form fields. For setting file inputs, this could be a local file path.\r\n Use this to send simple key events or to fill out form fields:\r\n form_textfield = driver.find_element(By.NAME, \'username\')\r\n form_textfield.send_keys("admin")\r\n This can also be used to set file inputs.\r\n\r\n file_input = driver.find_element(By.NAME, \'profilePic\')\r\n file_input.send_keys("path/to/profilepic.gif")\r\n # Generally it\'s better to wrap the file path in one of the methods\r\n # in os.path to return the actual path to support cross OS testing.\r\n # file_input.send_keys(os.path.abspath("path/to/profilepic.gif"))\r\n \'\'\'\r\n\r\n def fillField(self, xpath, text):\r\n\r\n\r\n\r\n def navigateto(self, urlstring):\r\n\r\n\r\n \'\'\'\r\n Gets the given attribute or property of the element.\r\n\r\n This method will first try to return the value of a property with the given name. If a property with that name doesn\xe2\x80\x99t exist, it returns the value of the attribute with the same name. If there\xe2\x80\x99s no attribute with that name, None is returned.\r\n\r\n Values which are considered truthy, that is equals \xe2\x80\x9ctrue\xe2\x80\x9d or \xe2\x80\x9cfalse\xe2\x80\x9d, are returned as booleans. All other non-None values are returned as strings. For attributes or properties which do not exist, None is returned.\r\n\r\n To obtain the exact value of the attribute or property, use get_dom_attribute() or get_property() methods respectively.\r\n\r\n Args:\t\r\n name - Name of the attribute/property to retrieve.\r\n Example:\r\n\r\n # Check if the "active" CSS class is applied to an element.\r\n is_active = "active" in target_element.get_attribute("class")\r\n \'\'\'\r\n def getAttribute(self, xpath,AttributeName):\r\n \r\n \r\n \'\'\'\r\n Gets the given attribute of the element. Unlike get_attribute(), this method only returns \r\n attributes declared in the element\xe2\x80\x99s HTML markup.\r\n\r\n Args:\t\r\n name - Name of the attribute to retrieve.\r\n Usage:\t\r\n text_length = target_element.get_dom_attribute("class")\r\n \'\'\'\r\n def getDomAttribute(self, xpath,AttributeName):\r\n ...\r\n\r\n\r\n\r\n \'\'\'\r\n Gets the given property of the element.\r\n\r\n Args:\t\r\n name - Name of the property to retrieve.\r\n Usage:\t\r\n text_length = target_element.get_property("text_length")\r\n \'\'\'\r\n def getProperty(self, xpath,PropertyName):\r\n ... \r\n \'\'\'\r\n Whether the element is visible to a user.\r\n \'\'\'\r\n def isElementDisplayed(self, xpath):\r\n ...\r\n \'\'\'\r\n Returns whether the element is enabled.\r\n \'\'\'\r\n def isElementEnabled(self, xpath):\r\n ... \r\n\r\n \'\'\'\r\n Returns whether the element is selected.\r\n\r\n Can be used to check if a checkbox or radio button is selected.\r\n \'\'\'\r\n def isElementSelected(self, xpath):\r\n ...\r\n \r\n \'\'\'\r\n Saves a screenshot of the current element to a PNG image file. Returns\r\n False if there is any IOError, else returns True. Use full paths in your filename.\r\n \'\'\'\r\n def currentElementScreenshot(self, xpath,screenShotSavingPath):\r\n ...\r\n # action class\r\n\r\n def actionClick(self, xpath):\r\n ...\r\n\r\n def actionClickandHold(self, xpath=None):\r\n ...\r\n\r\n def moveToElement(self, xpath):\r\n ...\r\n\r\n def moveToElementWithOffset(self, xpath, xoffset, yoffset):\r\n ...\r\n\r\n def moveByOffsett(self, xoffset, yoffset):\r\n ...\r\n\r\n def actionRelease(self, xpath=None):\r\n ...\r\n\r\n def keyDown(self, ModifierKey, key, xpath=None):\r\n ...\r\n\r\n def keyUp(self, ModifierKey, key, xpath=None):\r\n ...\r\n\r\n def double_click(self, xpath: None):\r\n ...\r\n\r\n def righttClick(self, xpath=None):\r\n ...\r\n\r\n def resetActions(self):\r\n ...\r\n\r\n def sendKeys(self, *keys_to_send):\r\n ...\r\n\r\n def sendKeysToElement(self, xpath, *keys_to_send):\r\n ...\r\n \'\'\'\r\n Gets the full document screenshot of the current window as a base64 encoded string\r\n which is useful in embedded images in HTML.\r\n\r\n Usage:\t\r\n driver.get_full_page_screenshot_as_base64()\r\n \'\'\'\r\n def get_screenshot_ofcurrentActive_page_in_base64(self):\r\n ...\r\n\r\n \'\'\'\r\n Saves a full document screenshot of the current window to a PNG image file. Returns\r\n False if there is any IOError, else returns True. Use full paths in your filename.\r\n Args:\t\r\n filename: The full path you wish to save your screenshot to. This should end with a .png extension.\r\n Usage:\t\r\n driver.get_full_page_screenshot_as_file(\'/Screenshots/foo.png\')\r\n \'\'\'\r\n def get_screenshot_ofcurrentActive_page_asFile(self,filename:str):\r\n ... \r\n \'\'\'get_full_page_screenshot_as_png() \xe2\x86\x92 str\r\n Gets the full document screenshot of the current window as a binary data.\r\n\r\n Usage:\t\r\n driver.get_full_page_screenshot_as_png()\r\n \'\'\'\r\n def get_screenshot_ofcurrentActive_page_asPNG(self):\r\n ...\r\n\r\n \'\'\' \r\n Saves a screenshot of the current window to a PNG image file. Returns\r\n False if there is any IOError, else returns True. Use full paths in your filename.\r\n Args:\t\r\n filename: The full path you wish to save your screenshot to. This should end with a .png extension.\r\n Usage:\t\r\n driver.save_screenshot(\'/Screenshots/foo.png\')\r\n \'\'\'\r\n def screenshot_save_full_page_screenshot(self,filename):\r\n ...\r\n\r\n \'\'\'\r\n returns the embedded text in the image.\r\n It returns a list of detected text, with each text element containing three types of information. \r\n Which are: the text, its bounding box vertices, and the confidence level of the text detection\r\n \'\'\' \r\n def get_embeddedText_from_image(self,path:str):\r\n ... \r\n \r\n\r\n### Drag and Drop\r\n\r\npython\r\n\r\ndef dragAndDrop(self, sourcexpath, destinationxpath):\r\n ...\r\n\r\n def dragAndDropByOffset(self, sourcexpath, xoffset, yoffset):\r\n ...\r\n\r\n### window and frame functions\r\npython\r\n def switchToWindowUsingName(self, windowName):\r\n ... \r\n\r\n def switchtoWindowUsingHandle(self, windowNumber):\r\n ... \r\n # frame switch, It\xe2\x80\x99s possible to access subframes by separating the path with a dot,\r\n # and you can specify the frame by its index too. That is: driver.switch_to_frame("frameName.0.child")\r\n # would go to the frame named \xe2\x80\x9cchild\xe2\x80\x9d of the first subframe of the frame called \xe2\x80\x9cframeName\xe2\x80\x9d. All frames are evaluated as if from *top*.\r\n\r\n def swithToFrame(self, xpath):\r\n ... \r\n \r\n # Once we are done with working on frames, we will have to come back to the parent\r\n # frame which can be done using:\r\n\r\n def swithToParentFrame(self):\r\n ... \r\n\r\n\r\n### Dropdown\r\npython\r\n\r\n def selectDropDownByValue(self, xpath, valueToSelect):\r\n ... \r\n\r\n def selectDropDownByIndex(self, xpath, indexToSelect):\r\n elementPresense=super().WaitFor_PresenseOf_Element_Located(xpath)\r\n #elementVisibility=super().WaitFor_VisibilityOf_Element_Located(xpath)\r\n if(elementPresense):\r\n #if(elementVisibility):\r\n select = Select(self.browser.find_element(By.XPATH, xpath))\r\n select.select_by_index(indexToSelect)\r\n\r\n def selectDropDownByVisibleText(self, xpath, textToSelect):\r\n ... \r\n\r\n def deselectAllOptionsInDropDown(self, xpath):\r\n ... \r\n\r\n def getDefaultSelectedDropDownOptions(self, xpath):\r\n ... \r\n\r\n def getAllOptionInDropDown(self, xpath):\r\n ... \r\n\r\n def deselectByIndex(self, xpath, index):\r\n ... \r\n\r\n def deselectByValue(self, xpath, value):\r\n ... \r\n\r\n def deselectByVisibleText(self, xpath, text):\r\n ... \r\n\r\n def getFirstSelecteOption(self, xpath):\r\n ... \r\n\r\n### Alerts\r\npython\r\n #alerts\r\n # Use this class to interact with alert prompts. \r\n # It contains methods for dismissing, accepting, inputting, and getting text from alert prompts. \r\n def acceptAlert(self):\r\n ... \r\n def dismissAlert(self):\r\n ... \r\n def getAlertText(self):\r\n ... \r\n def sendKeystoAlert(self,keysToSend):\r\n ... \r\n'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyseleniumbot-1.0.14.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyseleniumbot-1.0.14-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file pyseleniumbot-1.0.14.tar.gz.

File metadata

  • Download URL: pyseleniumbot-1.0.14.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for pyseleniumbot-1.0.14.tar.gz
Algorithm Hash digest
SHA256 328b71029fbe498647a09bbf1796c0488fa1611a805ebfb3f00b70a2a1dc2b06
MD5 a9d60805e947e1a1098540b1d658573e
BLAKE2b-256 6870a31f7b4f0f50d6610c0515b5355b867b03efb17e6085a5c0d3a032db28e7

See more details on using hashes here.

File details

Details for the file pyseleniumbot-1.0.14-py3-none-any.whl.

File metadata

  • Download URL: pyseleniumbot-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for pyseleniumbot-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 973293d1e270b8b39f5fc0c4666def119c51b6de9f83655f0b6286f44411b246
MD5 d94fac648135d6f56688846801dd1ac8
BLAKE2b-256 01d19ab13c12d29f722ab7564e7711ce9feed507ff6a86e6db22e2649d00d004

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page