Home >Backend Development >Python Tutorial >How to access local html in pythonn

How to access local html in pythonn

anonymity
anonymityOriginal
2019-06-17 16:23:379740browse

How does pythonn access local html? For local HTML files, if you want Python to read the local HTML files, you can use Selenium to read them.

How to access local html in pythonn

#What is Selenium?

Selenium is a tool for web application testing. Selenium tests run directly in the browser, just like real users. Supported browsers include IE (7, 8, 9, 10, 11), Mozilla Firefox, Safari, Google Chrome, Opera, etc. The main functions of this tool include: Test compatibility with browsers - test your application to see if it can work well on different browsers and operating systems. Test system functionality – Create regression tests to verify software functionality and user requirements.

Code example:

from selenium import webdriver
def login():
    driver = webdriver.Chrome()
    driver.get("file:///Users/Devintern/Documents/pachong/ML_flow/pachong/yx/files/yx.html")
if __name__ == '__main__':
    login()

Key point: file:// in get(file:// html path) cannot be missing

The above is the detailed content of How to access local html in pythonn. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn