Python Selenium Cheat Sheet
Python Selenium Cheat Sheet
Download WebDriver (e.g., ChromeDriver) and add to PATH or specify path in code.
Basic import:
```python
from selenium import webdriver
```
3. Locating Elements
5. Handling Forms
7. Navigating Pages
```
```python
cookies = driver.get_cookies()
driver.add_cookie({"name": "foo", "value": "bar"})
driver.delete_cookie("foo")
driver.delete_all_cookies()
```
actions = ActionChains(driver)
element = driver.find_element("id", "element_id")
actions.move_to_element(element).perform() # Hover
actions.click_and_hold(source).move_to_element(target).release().perform() # Drag and drop
```
Python Selenium Complete Cheat Sheet