zoukankan      html  css  js  c++  java
  • 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()

    来自 https://www.cnblogs.com/longsongpong/p/10272931.html

  • 相关阅读:
    第一个C#程序
    定位网页元素
    盒子模型
    浮动
    css3美化网页元素
    html css3
    java表单基础
    表单
    html5基础
    java程序题目解析
  • 原文地址:https://www.cnblogs.com/wang102030/p/11895656.html
Copyright © 2011-2022 走看看