selenium設置Chrome瀏覽器不出現通知,設置代理IP


from selenium import webdriver

PROXY = ""
chrome_options = webdriver.ChromeOptions()
prefs = {
    "profile.default_content_setting_values" :
        {
        "notifications" : 2
         },
     "profile.managed_default_content_settings.images" : 2
}
chrome_options.add_argument('--proxy-server={0}'.format(PROXY))     # 設置代理
chrome_options.add_experimental_option("prefs",prefs)               #設置瀏覽器不出現通知
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.implicitly_wait(10)
driver.get("https://www.facebook.com/")
driver.find_element_by_xpath('//*[@id="email"]').send_keys("2549433022@qq.com")    #輸入賬號密碼
driver.find_element_by_xpath('//*[@id="pass"]').send_keys("jiaying1026")

driver.find_element_by_xpath('//*[@id="loginbutton"]/input').click()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM