Selenium Notes

Page Contents

References / useful Links

  • https://stackoverflow.com/a/36896766/1517244
  • https://stackoverflow.com/a/40735204/1517244

Debug Page: Get All Elements With IDs

print([
    x.get_attribute("id")
    for x
    in self.driver.execute_script("return document.querySelectorAll('*[id]');")
])

Override WebElement.Click()

# monkey patch the click method :
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.remote.command import Command
def WebElement_click(self):
    print("### BUTTON CLICK {}".format(self.get_property("id") ))
    self._execute(Command.CLICK_ELEMENT)
WebElement.click = WebElement_click