from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC def test01(): options = webdriver.FirefoxOptions() profile = webdriver.FirefoxProfile() ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36' # profile.set_preference("network.proxy.type", 4) #自动检测代理设置 profile.set_preference("dom.webdriver.enabled", False) # 设置非driver驱动 profile.set_preference('useAutomationExtension', False) #关闭自动化提示 profile.update_preferences() #更新设置 driver = webdriver.Firefox(firefox_options=options ,firefox_profile=profile) driver.maximize_window() driver.get(r"https://www.vmgirls.com") html = driver.page_source print(html) if __name__ == '__main__': test01()