javascript - Run selenium script through proxy Python chrome -
i'm trying open chrome through proxy problem opens chrome correctly , can't access page proxy blocked or shows website not accesible works without proxy tho.
code
import mechanize import urllib urllib import urlopen import cookielib import beautifulsoup import html2text import re import sys import stringio urllib2 import httperror import os import time selenium import webdriver selenium.webdriver.common.keys import keys import requests import smtplib email.mime.text import mimetext import pickle ########################################################## adidasloginpage = "https://www.adidas.fr/on/demandware.store/sites-adidas-fr-site/fr_fr/myaccount-createorlogin" sleepseconds = 2 emailusername = "testadidasacc@gmail.com" emailpassword = "ya23" global threedigit ########################################################## chrome_option = webdriver.chromeoptions() chrome_option.add_argument("--proxy-server=admin:xxxxx@92.xxx.xxx.180:3128" ) driver = webdriver.chrome(executable_path='c:\windows\chromedriver.exe',chrome_options=chrome_option) def login(): driver.get(adidasloginpage) time.sleep(sleepseconds) driver.switch_to.frame(driver.find_element_by_id("loginaccountframe")) emailbox = driver.find_element_by_id("username") emailbox.send_keys(emailusername) passwordbox = driver.find_element_by_id("password") passwordbox.send_keys(emailpassword) time.sleep(sleepseconds) loginbutton = driver.find_element_by_id("signinsubmit") loginbutton.click() pickle.dump(driver.get_cookies(), open("cookies.pkl","wb")) login() ###############################################################
Comments
Post a Comment