<jupyter_start><jupyter_text>Python Reference - XPath**Author:** <NAME> Definitionnot really related to python, but xpath is a great tool to locate html elements for webcrawlers Linkshttps://www.w3schools.com/xml/xpath_intro.asp  select element that directly contains a specific text<jupyter_code>"//button[contains(text(), 'More Options')]"<jupyter_output><empty_output><jupyter_text>select element that contains another element with a specific text<jupyter_code>"//button[contains(.//span, 'More Options')]"<jupyter_output><empty_output><jupyter_text>select element that has an attribute with a specific text<jupyter_code>"//button[@name=\"followers-button\"]"
"//button[contains(@name, 'followers-button')]"<jupyter_output><empty_output><jupyter_text>select element by id<jupyter_code>//*[@id="email"]<jupyter_output><empty_output><jupyter_text>select element by multiple conditions<jupyter_code>"//div[contains(@role, 'button') and contains(.//span, 'Use cell phone number')]"<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13960396039603962, 'fraction_numerical': 0.0009900990099009901, 'mean_word_length': 9.11, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '276387', 'license': 'MIT', 'n_tokens_mistral': 328, 'n_tokens_neox': 317, 'n_words': 68, 'path': 'Webcrawlers/XPath.ipynb', 'repo_name': 'Architect0711/PythonReference', 'size': '1018'}