selenium.webdriver.support.event_firing_webdriver
1. class selenium.webdriver.support.event_firing_webdriver.EventFiringWebDriver(driver, event_listener)
WebDriver 实例的包装器,支持触发事件
1.1. EventFiringWebDriver(driver, event_listener)
创建 EventFiringWebDriver 的新实例
-
参数:
-
driver : WebDriver 实例
-
event_listener : 继承 AbstractEventListener 的实例
-
-
举例:
from selenium.webdriver import Firefox
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener
class MyListener(AbstractEventListener):
def before_navigate_to(self, url, driver):
print("Before navigate to %s" % url)
def after_navigate_to(self, url, driver):
print("After navigate to %s" % url)
driver = Firefox()
ef_driver = EventFiringWebDriver(driver, MyListener())
ef_driver.get("http://www.google.co.in/")
1.2. back()
1.3. close()
1.4. execute_async_script(script, *args)
1.5. execute_script(script, *args)
1.6. find_element(by='id', value=None)
1.7. find_element_by_class_name(name)
1.8. find_element_by_css_selector(css_selector)
1.9. find_element_by_id(id_)
1.10. find_element_by_link_text(link_text)
1.11. find_element_by_name(name)
1.12. find_element_by_partial_link_text(link_text)
1.13. find_element_by_tag_name(name)
1.14. find_element_by_xpath(xpath)
1.15. find_elements(by='id', value=None)
1.16. find_elements_by_class_name(name)
1.17. find_elements_by_css_selector(css_selector)
1.18. find_elements_by_id(id_)
1.19. find_elements_by_link_text(text)
1.20. find_elements_by_name(name)
1.21. find_elements_by_partial_link_text(link_text)
1.22. find_elements_by_tag_name(name)
1.23. find_elements_by_xpath(xpath)
1.24. forward()
1.25. get(url)
1.26. quit()
1.27. wrapped_driver
返回 EventsFiringWebDriver 包装的 WebDriver 实例
2. class selenium.webdriver.support.event_firing_webdriver.EventFiringWebElement(webelement, ef_driver)
WebElement 实例的包装器,支持触发事件
2.1. EventFiringWebElement(webelement, ef_driver)
创建 EventFiringWebElement 的新实例
2.2. clear()
2.3. click()
2.4. find_element(by='id', value=None)
2.5. find_element_by_class_name(name)
2.6. find_element_by_css_selector(css_selector)
2.7. find_element_by_id(id_)
2.8. find_element_by_link_text(link_text)
2.9. find_element_by_name(name)
2.10. find_element_by_partial_link_text(link_text)
2.11. find_element_by_tag_name(name)
2.12. find_element_by_xpath(xpath)
2.13. find_elements(by='id', value=None)
2.14. find_elements_by_class_name(name)
2.15. find_elements_by_css_selector(css_selector)
2.16. find_elements_by_id(id_)
2.17. find_elements_by_link_text(link_text)
2.18. find_elements_by_name(name)
2.19. find_elements_by_partial_link_text(link_text)
2.20. find_elements_by_tag_name(name)
2.21. find_elements_by_xpath(xpath)
2.22. send_keys(*value)
2.23. wrapped_element
返回 EventFiringWebElement 包装的 WebElement 实例