Skip to content

Instantly share code, notes, and snippets.

View callahantiff's full-sized avatar
🦈
beep bop booping

Tiffany J. Callahan callahantiff

🦈
beep bop booping
View GitHub Profile
@callahantiff
callahantiff / xpath_soup.py
Created July 11, 2019 15:31 — forked from ergoithz/xpath_soup.py
Generate unique XPATH for BeautifulSoup element
#!/usr/bin/python
# -*- coding: utf-8 -*-
def xpath_soup(element):
"""
Generate xpath from BeautifulSoup4 element
:param element: BeautifulSoup4 element.
:type element: bs4.element.Tag or bs4.element.NavigableString
:return: xpath as string